HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.33k stars 1.69k forks source link

Dashboard Requires Job Code to Be Deployed #433

Open jkodroff opened 9 years ago

jkodroff commented 9 years ago

We'd like to have a single lightweight Hangfire Dashboard to monitor all of our Hangfire instances across multiple tenants. Unfortunately, in order to display, e.g. a succeeded recurring job, we would also have to deploy the assembly which contains the job's source code or else we see an error message for each job stating "Can not find the target method". I believe this is an unnecessary restriction.

It looks like the problem lies around the SqlServerMonitoringApi code: The SucceededJobDto class has a Job member, and in deserializing the Job it tries to find the method to invoke via reflection in order to get the [DisplayAttribute] etc. Instead, I think displaying the list of completed jobs should only be dependent on the data stored in the database instead of deserializing the same Job class that we use to run a job (i.e. Single Responsibility Principle). This makes deploying the dashboard separately a lot cleaner.

I also think this is more "correct" since we should display the info for the job as it was at the time the job was run. I know that #199 addresses this issue in part (although it hasn't been merged yet), but I think this proposed solution is a little stronger in that it will display more helpful information and will more accurately reflect what was actually run, unaffected by any future changes to the code base.

Hopefully this will also allow jobs to be requeued without requiring the job code to be deployed with the dashboard.

I'm willing to submit a PR for this with @odinserj's blessing.

odinserj commented 9 years ago

Dashboard is not only showing the information about background jobs, it also allows to re-queue and delete jobs. And these commands require job type and job method in order to run all the job filters. Have you thought about using interfaces as jobs and placing them to the common assembly? In this case you aren't required to have the source code in one place, only interfaces.

mattkoch614 commented 8 years ago

@odinserj

Have you thought about using interfaces as jobs and placing them to the common assembly? In this case you aren't required to have the source code in one place, only interfaces.

How would one go about doing this?

cd21h commented 7 years ago

@odinserj If assembly is not available, is it possible to display at least payload? If assembly is not available, just disable Requeue button.

smasherprog commented 7 years ago

This seems like it should be a simple fix. The hangfire dashboard should only display the information in the database, why would it matter whether the dll is available to the dashboard? Does the dashboard need the dll in order to do some other function?

valleskon commented 5 years ago

is this still on the road map i have similar issue. image

thanks.