SugarCRM SupportProduct GuidesSugar DeveloperSugar Developer Guide 10.3ArchitectureJob Queue
This release is only available for SugarCloud customers.

Job Queue

Overview

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.

Job_queue_actors

Stages

Schedule Stage

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.

Execution Stage

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.

Cleanup Stage

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).

Topics

    Sugar provides a Scheduler service that can execute predefined functions asynchronously on a periodic basis. The Scheduler integrates with external UNIX systems and Windows systems to run jobs that are scheduled through those systems. The typical configuration is to have a UNIX cron job or a Windows scheduled job execute the Sugar Scheduler service every couple of minutes. The Scheduler service checks the list of Schedulers defined in the Scheduler Admin screen and executes any that are currently due.
    Jobs are the individual runs of the specified function from a scheduler. This article will outline the various parts of a Scheduler Job.

Last modified: 2021-01-06 23:28:41