Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Delayed and Repeated Processing

Question:

What features are available to delay and/or repeat processing of jobs (sleep/wake)?

Answer:

The following delays are methods of delay have been implemented:

  • A simple way to make a job sleep and wake up is to configure a repeat interval in hours, minutes and seconds. In this case the job is not exactly "delayed" but will be restarted as soon as the interval has elapsed.

  • A job can delay its processing by the JobScheduler API method delay_spooler_process(seconds_or_hhmmss). This is available only if the job implements the API's method spooler_process() of the API. In this case the job remains loaded, i.e. it is in processing but uses no CPU until the scheduled interval has elapsed.

  • A job can be configured for restart should an error have occurred, for example by configuration or API methods:

    Code Block
    languagetext
    	spooler_job.delay_after_error(  2 ) = 10;           // 10 seconds
    
        
    spooler_job.delay_after_error(  5 ) = "00:01";      // one minute
    
        
    spooler_job.delay_after_error( 10 ) = "24:00";      // one day
    
        spooler_job.delay_after_error( 20 ) = "STOP";
    
                               

    In this example, JobScheduler repeats a job immediately after a (first) error occurs. After two to four consecutive errors, however, JobScheduler delays restarting the job by 10 seconds; between five and nine consecutive errors, the delay is one minute; between ten and nineteen errors, it is 24 hours. The job is stopped after the twentieth consecutive error.

    It is possible to set the value of the seconds_or_hhmm_ss parameter to "STOP" in order to restrict the number of (unsuccessful) repetitions of a job. The job then is stopped, i.e. will not restart automatically, when the number of consecutive errors specified is reached.