The Job Queue executes automated tasks in Sugar through a scheduler, which integrates with external UNIX systems and Windows systems to run jobs that are scheduled through those systems. Jobs are the individual runs of the specified function from a scheduler.
The Job Queue is composed of the following parts:
- SugarJobQueue : Implements the queue functionality. The queue contains the various jobs.
- SchedulersJob : A single instance of a job. This represents a single executable task and is held in the SugarJobQueue.
- Scheduler : This is a periodically occurring job.
- SugarCronJobs : The cron process that uses SugarJobQueue to run jobs. It runs periodically and does not support parallel execution.
On the scheduling stage (
checkPendingJobs in Scheduler class), the queue checks if any schedules are qualified to run at this time and do not have job instance already in the queue. If such schedules exist, a job instance will immediately be created for each.
The SQL queue table is checked for any jobs in the "Pending" status. These will be set to "Running"' and then executed in accordance to its target and settings.
The queue is checked for jobs that are in the "Running" state longer than the defined timeout. Such jobs are considered "Failed" jobs (they may be re-queued if their definition includes re-queuing on failure).
Last modified: 2021-01-06 23:28:41