Lead your team forward
OCT 24 / 9AM ET Register nowScheduler
The scheduler is an online server component that allows scheduling and running generic jobs - executing a workflow, Windows command, or a Shell script. Since the scheduler is an online server component, the server must be running in order to start scheduled jobs.
Schedule definitions (*.sch
files) are read from the directories specified by the sources
configuration.
Each job execution is then logged using the configured resultPersister
(see How to Log Schedule Execution).
ONE Runtime Server Admin integration
To be able to run workflows on the server, both the Scheduler and Workflow Component must be defined in the server configuration. The scheduler interface is automatically available in the ONE Runtime Server Admin allowing you to:
-
List schedules and display their state (last execution, next execution).
-
See their statuses (enabled, disabled, error).
-
enable/disable a schedule (which is reflected in the schedule configuration files).
-
show execution history as tracked by persister.
-
perform "Run Now" action on valid schedules.
-
lists invalid schedules and display problem information.
-
display state in the server Health monitoring - displays next execution and number of scheduled jobs.
Schedule configuration
Each job you want to schedule must be defined in its own .sch
configuration file.
There must be only one scheduleDefinition
element in each configuration file containing only one job
definition.
Each file must represent a valid XML document (having just one scheduleDefinition
root element).
The available jobs and their definition are described in Available jobs.
Example
The schedule is defined using the following format:
<scheduleDefinition>
<description>notepad runner</description>
<enabled>false</enabled>
<job logStartStop="false" command="notepad.exe" class="com.ataccama.adt.scheduler.job.RunWinCmdJob" workingDir="."/>
<scheduling>33 10 4 * </scheduling>
</scheduleDefinition>
If this example is enabled, it would start the Notepad every Thursday at 10:33. It must be either enabled to be run on the closest suitable day and time, or it can be started by the Run Now option in the ONE Runtime Server Admin without changing its status.
Enable a schedule
A job is scheduled only if the enabled
property is set to true
.
The property can be set to enabled or disabled either in the Scheduler configuration file or using the ONE Runtime Server Admin Scheduler section of the Workflows.
Scheduling definition
We do not support full Cron format. We only support the format described in this section. |
The scheduler uses a Cron-like scheduling definition with a minimal interval of one minute. The format contains date definitions in the following order:
minutes hours day_of_week day_of_month
Statements are separated by a space character.
For each statement in the format you can use an asterisk (*
), which stands for 'any' value or defines the numeric value:
-
By direct definition, for example
33
. -
By collection definition, for example,
33,42,35
. -
By interval definition, for example`10-15`.
Which is equal to
10,11,12,13,14,15
.
These numeric definitions can be combined, for example, 10-15,30-31
means 10,11,12,13,14,15,30,31
.
Numbers for day_of_week numbers run from 1 (Monday) to 7 (Sunday).
|
// minutes range definiton
private static final int RANGE_MINUTE_FROM = 0;
private static final int RANGE_MINUTE_TO = 59;
// hours range definiton
private static final int RANGE_HOUR_FROM = 0;
private static final int RANGE_HOUR_TO = 23;
// days of week range definiton
private static final int RANGE_WEEK_FROM = 1;
private static final int RANGE_WEEK_TO = 7;
// days of month range definiton
private static final int RANGE_MONTH_FROM = 1;
private static final int RANGE_MONTH_TO = 31;
When time changes by less than three hours, like at the beginning or end of the daylight saving time, missed or repeated jobs are handled as follows:
When time is changed by more than three hours, there is no special implementation for missed or repeated jobs. Jobs are never run in parallel. When a scheduled job is running at the time it should run again, it does not start. Instead, that scheduling slot is missed and the job runs the next time its scheduling definition is matched, provided that it is not currently running. |
Available jobs
Run Windows command job
The job executes a Windows shell command.
It utilizes a temporary script file (created in the job’s resources folder) to execute more complex scripts and return correct return-value using exit %ERRORLEVEL%
instruction.
<job class="com.ataccama.adt.scheduler.job.RunWinCmdJob">
<command>D:\development\releases\v7-dqc-daily\dqc.exe"</command>
<workingDir>d:\var\server</workingDir>
</job>
Parameters:
-
command - Defines the command to execute.
-
workingDir - Defines the working directory to be used for execution. If not defined, then the directory containing the job configuration is used.
-
logStartStop - If set to
true
, the start and stop marks are written to the standard output log. Default value:true
.
Run shell script job
The job executes a Unix-like script.
It uses a temporary script file to execute specified commands (the script file is created in the job’s resources directory).
This script file is then passed to the selected interpreter (/bin/sh
by default).
<job class="com.ataccama.adt.scheduler.job.RunShellScriptJob">
<command>/development/releases/v7-dqc-daily/dqc</command>
<workingDir>server</workingDir>
<interpreter>/bin/bash</interpreter>
</job>
Parameters:
-
command - Defines the shell script command to execute.
-
workingDir - Defines the working directory used for execution. If not defined, then the directory containing the job configuration is used.
-
interpreter - Path to the interpreter on the target system that should be used to process the commands. Default value:
/bin/sh
. -
logStartStop - If set to
true
, the start and stop marks are written to the standard output log. Default value:true
.
Run workflow job
The job runs a specified workflow file.
The following example invokes a workflow simple-params.ewf
and passes two variables to it: command1
and command2
.
The variables
attribute is not mandatory, so if the workflow does not require any input variables, it can be empty.
...
<job class="com.ataccama.adt.scheduler.job.WorkflowJob">
<!-- for workflows coming from a named source use sourceId:workflowName notation, e.g. source1:myWorkflow.ewf -->
<workflow>simple-params.ewf</workflow>
<variables>
<variable name="command1" value="notepad"/>
<variable name="command2" value="notepad"/>
</variables>
</job>
...
Parameters:
-
workflow - The source ID and name of the workflow file written in the following format:
sourceId:workflowName.ewf
. If the Workflow Component uses only one folder as a source and it does not have an ID, specifying the workflow name is sufficient:workflowName.ewf
. -
variables - Allows passing variable values if they are defined in the referred workflow.
-
variable.name - The name of the variable.
-
variable.value - The value you wish to pass to the variable.
-
Was this page useful?