Reschedule failed jobs in hangfire - hangfire

Is it possible to reschedule failed jobs in hangfire? And Is there any way to clear the failed job queue after the success?
How is it possible?

Jobs will be cleared automatically by hangfire after one day (by default).
https://discuss.hangfire.io/t/how-to-configure-the-retention-time-of-job/34/2?u=odinserj
See hangfire documentation about dealing with exceptions occurs during jobs execution
http://docs.hangfire.io/en/latest/background-processing/dealing-with-exceptions.html

Related

Hangfire fetches but doesn't queue

I am having issue where when I trigger a hangfire task it doesn't process. It shows as fetched but not queued.
If I fully delete the hangfire schema and restart my application then I am able to run the task to completion but then subsequent triggered tasks go into the same fetched state.
If I look in succeeded then there is a count for a succeeded task but nothing shows:
The code itself executes fine (on first attempt after schema built). It looks like some error is happening on task completion but I see no error in the logs.
I am using Hangfire.PostgreSQL provider.
How can I fix/debug this?

Hangfire Recurring Job gives ERROR in second execution

I have a recurring job, it works perfectly first time, but after the next execution, it gives ERROR. However, there isn't any exception or error in my GetPendingTrips() method.
Can some guide me what is the issue here in next attempt of recurring job?
RecurringJob.AddOrUpdate<ITripManager>(nameof(ITripManager), job => job.GetPendingTrips(), Cron.Minutely);
I have realized that Hangfire will not work continuously on background in IIS server, it will immediately stop the recurring job when there isn't any activity on the server. So in order to run the recurring job you need to do the following steps as mentioned in this article.
https://docs.hangfire.io/en/latest/deployment-to-production/making-aspnet-app-always-running.html

resque scheduler not enqueue jobs

Schedules exist to be executed at certain times as defined in the schedule, but the tasks are not executed.
There is an option in the schedule to manually start that specific scheduled task and that will execute and perform the tasks. This shows that the task can be performed, it is just not starting automatically.
There were 2 issues here:
There are some resque and resque scheduler processes are running from old release path (Capistrano create folder for each release and do symlink the “current” to latest release path). This leads to incorrect jobs picking for some schedules
The current upstart script for resque scheduler doesn’t include dynamic schedules, so the dynamic schedules don’t be picked.

Hangfire queues recurring jobs

I use hangfire to run recurring jobs.
My job get current data from the database, perform an action and leave a trace on records processed. If a job didn't run this minute - I have no need to run it twice the next minute.
Somehow I got my recurring jobs (1 minute cycle) queued by their thousands and never executed. When I restarted my IIS it tried to execute them all at once and clog the DB.
Besides than fixing the problem of no execution, is there a way to stop them from queuing up?
If you want to disable retry of failed job simply decorate your method with an AutomaticRetryAttribute and set Attempts to 0
See https://github.com/HangfireIO/Hangfire/blob/master/src/Hangfire.Core/AutomaticRetryAttribute.cs for more details

Oozie start time and submission time delay

I'm working on a workflow that has both Hive and Java actions. Very often we have been noticing that there is a few minutes delay between Java action start time and the job submission time. We don't see that with Hive jobs, meaning Hive jobs seem to be submitted almost immediately after they are started. The Java jobs do not do much and so they finish successfully in seconds after they are submitted but the time between start and submission seem to be very night ( 4 -5 minutes). We are using fair scheduler and the there are enough mapper/reducer slots available. But still even if it's a resource problem the Hive jobs should also show delay between start and submission but they don't ! Java jobs are very simple jobs and they don't process any files etc and basically used to call a web service and they spawn only single mapper and no reducers where are the Hive jobs creates hundreds of mapper/reducer tasks but still there is not delay between start and submission. We are not able to figure out why oozie is not submitting the Java job immediately. Any ideas?