Job Configuration
The Configuration consists of the following components:
- Schedule. Controls if and how often the Job is executed
- Steps. Each Standard and External Job consists of one or more steps to be executed
- Parameters. Jobs can optionally have one or more parameters. They are typically used for passing information between steps or executions.
Job Schedule
The Scheduling is based on a cron expression. See Link for examples. The time portion is specified in the UTC timezone.
Note that the scheduling expresses the earliest possible time for the Job to start. The platform allows up to five Jobs to run simultaneously, so it's possible that the Job will have to wait a bit longer before starting.
Alternatively to specifying a cron expression, the Job can be configured as Manual. This means that the Job won't start automatically, but has to be triggered each time, either through the API or the Portal.
Steps
Each Standard and External Job consists of one or more steps. The steps will be executed in sequence, and each step will run within its own database transaction. Once a step is completed it moves on to the next step, fails or goes back to ASLEEP.
Note that at the end of each step there will either be a database commit (if it succeeded without errors) or a rollback (if it failed).
Each step needs to have a unique name and a step type. It is also possible to specify a runIfExpression which, if specified, gets evaluated before the step is started. If it returns true then the step is executed, otherwise it is skipped.
There are several different types of steps, each with a different purpose. Examples are SQL steps, List manipulation steps, File import/export steps etc. See next section for explanation of each type of step.
When configuring a step you need to tell what should happen if the step fails. The options are:
Fail Action | Description |
---|---|
CONTINUE | Ignores the fact that the step failed, and simply moves on to the next step. If this was the last step then the Job just goes back to sleep. |
RETRY | The Job will temporary pause (to let other database transactions complete etc) and then the failed step will be retried again. If the step fails three times in a row then the whole Job stops and is marked as FAILED. |
RESTART | The Job goes to sleep momentarily and will then restart with the first step in the sequence. |
FAIL | The Job will stop and be marked as FAILED |
Job Parameters
It is also possible to configure one or more parameters that will be used by the Job. These are global for the Job and shared by all steps. Benefits of parameters include:
- They can be used as read-only configurations for the Job
- They can be used to pass information between Job steps, for example one step may select a maximum identifier from a table, which is then used as input by the following steps
- They can be used for incremental or differential loads and manipulations. For performance reasons it may be better to only process new records in a table since last time the Job ran, as opposed to processing a full table. This is described in detail later
The parameters must have a name and a datatype. They can optionally also be given a default value.
Parameters are used in SQL statement by preceding their name with a @ character.
SELECT * FROM ng_activity_tb WHERE activity_id > @MyParameter
Updated 11 months ago