developer handling late scheduling of jobs

I’m Late, I’m Late. Handling the Late Scheduling of Jobs

 

I’m Late, I’m Late. Handling the Late Scheduling of Jobs

A scheduled batch job might not run on time (i.e., be “late”) for many reasons - for example:

  • the scheduler might be down for an extended period of time, during which one or more jobs would normally have run.
  • there is not enough concurrency available to process jobs in a timely manner, so a queued job may not be reached for scheduling until after it’s time to execute has passed.
  • A required resource for your job may not be available so your job must wait. This is common when your job performs file transfers from a remote service and the remote service is down.

Such circumstances can often be handled manually by pausing or restarting jobs, but this can quickly become overwhelming, especially when many jobs are involved.

To handle this, jobs need a defined way of telling the scheduler what the absolute latest time the job can run without being skipped. This is referred to as a “late time window.”

For example, a late time window of "+5m" (five minutes) means that the job can fire up to five minutes past its scheduled firing time. A late time window of "+1d" would allow the job to fire up to one day late.

If the job attempts to run but the late time window has elapsed, the scheduler will simply determine the next scheduled date, skip the late job, and continue running as normal (unless makeup firing is enabled – see further down in this post).

Scheduled Date/TimeLate Time WindowDate on Clock NowTime Expression for Next RunResult
April 30, 2020 08:00:00+6HApril 30, 2020 10:30:00+6HActual date is within the late time window, so the job fires. Only one firing was missed so the job continues as normal, scheduling the next firing for 14:00:00.
April 30, 2020 08:00:00+5mApril 30, 2020 08:06:00+6HActual date is not within the late time window, the job does not fire.  The scheduler simply schedules the next execution at 14:00:00 as though no firing was missed.
April 30, 2020 08:00:00+30mApril 30, 2020 08:25:00+10mActual date is within the window, so the job fires. Two additional firings were missed (08:10:00 and 08:20:00); the job fires again for each of those before setting the next date (April 30, 2020 08:30:00).
April 30, 2020 08:00:00+1HApril 30, 2020 10:30:00+1HActual date is not within the late time window, the job does not fire (even though one of the missed firings was within the window). The next firing date (April 30, 2020 11:00:00) is scheduled.

Makeup Firing Enabled

This property is only evaluated if the late time window has elapsed but there are one or more missed firings.

If makeup firing is enabled, at least one firing was missed, but that firing did not fall within the late window, then Flux will fire a single makeup firing before advancing to the next scheduled trigger date.

This is useful in cases where several firings were missed and did not fall within the late time window, but you still want to fire once to compensate for the missed firings.

Examples - Assume the scheduler was unavailable from April 30, 2020 07:59:00 to April 30, 2020 15:00:00

Scheduled Date/TimeLate Time WindowDate on Clock NowTime Expression for Next RunEnable Makeup FiringResult
April 30, 2020 08:00:00Not specifiedApril 30, 2020 15:00:00+6HNot specified (default is false)The trigger fires at April 30, 2020 15:00:00. The next date (April 30, 2020 20:00:00) is scheduled.
April 30, 2020 08:00:00+6HApril 30, 2020 15:00:00+6HtrueLate time window has elapsed but makeup firing is enabled, so the trigger fires at April 30, 2020 15:00:00. The next date (April 30, 2020 20:00:00) is scheduled.
April 30, 2020 08:00:00+6HApril 30, 2020 15:00:00+6HfalseLate time window elapsed and makeup firing is disabled, so the trigger does not fire. The next date (April 30, 2020 20:00:00) is scheduled.
April 30, 2020 08:00:00+1HApril 30, 2020 10:32:00+5mtrueLate time window has elapsed but makeup firing is enabled, so the the trigger fires. The next date (April 30, 2020 10:35:00) is scheduled.

For additional details of Flux’s handling of time schedules see https://doc.flux.ly/display/flux80/Timer+Trigger or contact support@flux.ly