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.42k stars 1.7k forks source link

Only disable Recurring jobs #173

Open Caldas opened 10 years ago

Caldas commented 10 years ago

I've expiried an network problem with some SQL database and the jobs related to consume data from there started to get error, ok.

I know that I will take at least 8 hours (8 executions, it's hourly) so I had to exclude the recurring jobs but my intention was only disable it, get some sleep fix the dam network problem and re-enable my recurring SQL data consuption jobs.

So a disable button on hangfire/recurring page would be very useful.

odinserj commented 10 years ago

Currently, recurring job scheduler will schedule a new job regardless of the processing status of previous job. Consider you have an option that the scheduler enqueues new job only on successful completion of the previous job. Will this option solve your problem?

jacobneroth commented 10 years ago

Is there an option to disable recurring jobs upon successful completion ? Meaning currently i have a job which runs every 20 mins from 6 PM to 7 PM , so basically 6:00/ 6:20 /6:40. So if is is successful the first time, can we stop the recurring job for just the next 2 intervails, so it will continue the next day.

In short change the next execution time to the next day.

odinserj commented 10 years ago

@jacobneroth, consider you can specify the retry intervals on your recurring job that is being executed daily:

[AutomaticRetry(Attempts = 3, Intervals = "1200")] // Intervals in seconds separated by commas
public void SomeMethod() { }

So in case of exception (unsuccessful execution) it will be retried automatically. Will this help you?

Disclaimer: feature described in this message is not related to recurring jobs and this issue.

odinserj commented 10 years ago

+1 for Enable & Disable buttons in Dashboard for recurring jobs and corresponding methods in API – this is pretty simple. This feature should be implemented after #158, #160, #167 to fix bugs first.

Caldas commented 10 years ago

Great.

In my case, sometimes, the server that I get data from get out of network and when this happens usually infra team take hours to re-establish the server. It would be great have a way to disable jobs and enable it back when infra is ready again

-----Mensagem Original----- De: "Sergey Odinokov" notifications@github.com Enviada em: ‎20/‎08/‎2014 16:21 Para: "HangfireIO/Hangfire" Hangfire@noreply.github.com Assunto: Re: [Hangfire] Only disable Recurring jobs (#173)

+1 for Enable & Disable buttons in Dashboard and corresponding methods in API. This feature should be implemented after #158, #160, #167 to fix bugs first. Scheduled to the next release. — Reply to this email directly or view it on GitHub.

Moulde commented 9 years ago

I was surprised to learn that this functionality is not included. It seems rather simple to include a flag on the recurring job?

bsimser commented 8 years ago

This is something I was hoping was in there (as I needed it tonight). Will take a look to see if I can offer a PR to implement this as it's been kicking around since 2014.

jyoung80 commented 8 years ago

Has there been any progress on this? I would also like this feature and will customise the code if required but my preference would be if it was included as base functionality.

WaltDaniels commented 8 years ago

This would be VERY useful in an corporate, production environment. Otherwise we have to create custom extensions, and modify every time we add a recurring job.

cemremengu commented 7 years ago

This is absolutely a must. Any progress ?

MichalGrzegorzak commented 7 years ago

Need this :/

dlazzarino commented 7 years ago

+1

adgoan commented 7 years ago

I tried to convince my team to start using hang fire and the lack of this feature Made almost every-one complain.

sergey-litvinov commented 7 years ago

@odinserj could you please share your thoughts about this issue and feature to enable\disable specific recurrent tasks? And if someone would actually make a pull request, would you consider to merge it? Or you have some preference to don't have such feature and won't accept such pull request? Thanks

shaneray commented 7 years ago

Also interested in this feature. Seems right now there is only an option to delete the RecurringJob (with no way of removing the delete option, causing it to be gone until application restart). I would much rather the option to disable/enable and also the option to not allow delete from dashboard. I have defined the recurring job in the code, I do not want someone to delete it from the dashboard (requiring an application restart or code to constantly add them back) where as enabling/disabling temporarily makes perfect sense.

suadev commented 6 years ago

@odinserj Any progress?

MirkoFl commented 6 years ago

Here is a workaround

https://discuss.hangfire.io/t/pause-disable-recurring-job/125

RudeySH commented 6 years ago

I have tried that workaround but I don't like it. The jobs don't really get paused, they just immediately get cancelled when they are triggered, resulting in "Succeeded" state.

RomanVashchegin commented 5 years ago

This workaround is not working now, filter is ignored on application pool restart.

udlose commented 4 years ago

@odinserj so 6 yrs since this was opened. Any progress or ETA?

RudeySH commented 4 years ago

You can programmatically "disable" them by setting the CRON expression to something silly like "0 0 31 2 *".

RecurringJob.AddOrUpdate(() => Foo(), "0 0 31 2 *"); // February 31st (a.k.a. never)

This will appear as DISABLED in the dashboard.

image

You can programmatically enable the jobs by setting the CRON expression back to something useful.

This is an ugly workaround but it sort of works.

Zureka commented 3 years ago

You can programmatically "disable" them by setting the CRON expression to something silly like "0 0 31 2 *".

RecurringJob.AddOrUpdate(() => Foo(), "0 0 31 2 *"); // February 31st (a.k.a. never)

This will appear as DISABLED in the dashboard.

image

You can programmatically enable the jobs by setting the CRON expression back to something useful.

This is an ugly workaround but it sort of works.

There is a Cron.Never option available for this that does the same thing: #1432

I plan to make the CRON schedules for my recurring jobs configurable as app settings, giving me the ability to disable a recurring job using the Cron.Never option. It would be nice if there was a convenient button for this on the Hangfire dashboard, but I can make this work.