Qorus Integration Engine®  4.0.3_git
Qorus Jobs

Job Overview

Jobs are simple tasks that have a schedule, similar to a cron job. Each time a job executes, a record is created in the database storing its status. The system supports a set of system APIs for controlling jobs, and a set of service methods for providing job configuration and status information.

Jobs are also members of interface groups; if a job is a member of a disabled group, then then job will not run when scheduled, even if it is active.

When jobs are scheduled and executed, log file entries are created; see System, Service, Workflow, and Job Logging for more information about log file locations and file formats.

Job Configuration

Jobs have the following attributes:

Job Attributes (table: JOBS)

Name Description
name The name of the job
version Version string for the job object; this version is informative; only one version of a job is stored in the database at a time
description Description of the job object
sessionid If the single_instance flag is set, and the job is currently running on a Qorus instance, then this attribute will have a value, otherwise it will not be set
active A boolean value giving the active status of the job; inactive jobs will not be scheduled and run
run_skipped A boolean value telling the system if the job should be run immediately if the last scheduled run was missed due to system downtime
single_instance A boolean value telling the system if the job can only be run on one Qorus instance at a time
code The code for the job; the job's Program object will be created out of this code and any library objects associated with the job; the resultant program will have its run() function executed when the job is executed
last_executed The last execution date/time of the job; will not have a value if the job has never been run
last_executed_job_instanceid The last executed instance id of the job
expiry_date The optional expiration date of the job
recurring a schedule duration in seconds; if present the job will be scheduled to run every n seconds where n is the value assigned to this attribute; either this or the Cron Schedule Fields attributes will be set, but not both
Cron Schedule Fields the cron schedule fields are as follows: minute, hour,day,month,wday, see Job Cron Schedule for more information on the meanings of these fields; either these attributes or the recurring attribute will be set, but not both
Library Objects A set of functions, classes, and constants that will be loaded into the workflow's program space; defined in table: JOB_LIB
Tags A list of user-defined tags for the job, stored in the JOB_TAGS table

Job Data

When jobs are executed, an entry in the JOB_INSTANCE table is created to track the status of processing the job.

Job instance rows have the following attributes: Job Instance Attributes

Name Description
job_instanceid The job instance ID
jobid The ID of the type of job that was executed
sessionid The Qorus application session ID of the controlling session when the job was executed
jobstatus The status of executing the job; see Job Data Status Descriptions for possible values
info An optional YAML-encoded field of information related to job processing; data will only be present in this field if the job calls job_save_info()
started The date/time the job was scheduled and started
completed The date/time the scheduled job compelted processing

Additionally, the JOB_STATE_DATA table is used to store persistent data related to job processing to aid in recovering jobs in case of errors. This table has one row for each job; the row for the job is cleared if the job has a OMQ::StatComplete status. Job state can be stored using OMQ::UserApi::Job::job_save_state_data() and retrieved with OMQ::UserApi::Job::job_get_state_data().