Article: AN0001793Updated: 23.10.2021
Jobs are used for planned execution of certain operations like import, export, workflow, scripts... Administrator is responsible for setting of jobs because they can represent a performance load for the server that has to be spread with consideration.
Execution
Job can be scheduled with various type of execution.
- one time - is executed once and never again
- after application start - it is executed whenever ObjectGears system starts
- daily - it starts on selected days at the defined time
- monthly - it is executed on the defined day in month and at the given time
Job can be switched off by the help of setting Enabled. It disables/enables its execution without deleting it. Later on the job can be activated again. It is possible to set also Valid From and Valid To. Job will be executed only within this period of time.
Processing
After job start all the job steps are processed. Number of these steps is not limited and they are processed in the order that is displayed on page JobSteps.aspx. You can change order of the steps by the help of the arrows.
Particular steps can be deactivated by means of the property Enabled. The deactivated step is skipped at the time of processing.
By means of setting Action after... you can control how the steps can be processed.
Job history
Every job start is logged into the job log (JobRuns.aspx). You can find there information about when the job started and when it finished. It also contains a link to a detailed log from the job processing (JobLog.aspx).
History of job process start
Apart from job history there is also History of job process start (JobStartLogs.aspx), which is log of the own process of the job execution. ObjectGears system executes several automated jobs, e.g. log maintenance, workflow, user jobs, email sending etc. In this log there is record about every execution of these processes.
If this log is not filled in, then the windows service, that takes care of this processing, is probably not running correctly.
Time plan
If there are more jobs scheduled or they are executed repeatedly, then the Time plan of job schedule (JobsTimePlan.aspx) will help to get a better view. This plan has form of a calender and displays what will be executed when. You can therefore easily discover times when several jobs are executed in a short period of time and increased system load may occur or you can find a free time window for new job.
Integration
Jobs are ofte used to start data imports and exports for integration with other systems. At the time when you move a production data into test or acceptance database you will probably want not to start these integration jobs.
Therefore, we recommend to set integration indication to these imports and exports. When the job will start and it will try to start an export or import an error will be returned and export or import will not start.
The indication can be set also for the whole job. You can simply unify several integration objects into a single batch. Only a single message (from the job) instead of several (from exportu, importu...) will be recorded in the log.
More information about enabling/disabling integrations.
Termination of the job or job step by script
In the job step of type Script you can terminate the whole job or the given job step. You can use three options with slightly different behaviour:
1) Terminating the job with a message but without raising an error.
OGResult.IsError = false;
OGResult.Message = 'End without raising an error';
This option will terminate the job and write into the job log a message. The whole job finishes with Result = OK.
2) Terminating the job with a message and an error raised.OGResult.IsError = true;
OGResult.Message = 'End with error';
This option will also terminate the job and writes a message into the job log. On top of that the job is terminating with Result = Error.
3) Terminating job step with error.OG.Throw('end of job');
This option will terminate one particular job step with an error. According to the setting in Action after job failure job either continues with the subsequent step or the whole job is terminated.