Introduction
This article describes how the substitution of parameter values works in JobScheduler. It also describes how to use parameters in shell script, API Jobs and pre- and postprocessing scripts.
Substitution of parameter values by the JobScheduler
- The JobScheduler substitutes the values of environment variables in task parameters using
, where${env_var}
env_var
is the name of an environment variable.- The JobScheduler will substitute
${env_var}
with anempty
value if the environment variable is unknown. - For Unix systems case sensitivity is considered for environment variables.
- The JobScheduler will substitute
- To prevent substitution in task parameters the environment variable can be quoted with a backslash, i.e. \
${env_var}
- JobScheduler does not substitute environment variables in order parameters.
Example
This job will create the following output:
Please note:
${test}
has been substituted to an empty value as this environment variable has not prevously been set.- To access the value of the parameter in a shell script, the parameter name has to be prefixed. The default value of the prefix is:
SCHEDULER_PARAM_
- This prefix can be set by the
scheduler.variable_name_prefix
parameter which is configured in the$scheduler_data/config/scheduler.xml
file. JobScheduler has to be restarted after the value of the prefix has been changed.
Substitution of parameter values by use of the Configuration Monitor
An additional substitution mechanism for jobs running in a job chain is provided by the sos.scheduler.managed.configuration.ConfigurationOrderMonitor
preprocessing Java class that is added as a Monitor to jobs.
Scope of substitution
This Java class implements the following steps:
- Before processing
- it copies the node parameters that are configured in
jobchain.config.xml
file to the order parameters. - if an order parameter exists with the same name then it will be overwritten.
- substitutes all
${param}
variables with:- JobScheduler parameters that are configured in the
$scheduler_data/config/scheduler.xml
file, - task parameters that are configured in the currently running job,
- order parameters that are configured with the order,
- node parameters that have been copied to the order parameters.
- JobScheduler parameters that are configured in the
- it copies the node parameters that are configured in
- After processing
- deletes all node parameters from the order.
Please note:
- If a task parameter value is to be substituted by the Configuration Monitor then the value has to be quoted with a backslash to prevent its substitution by the JobScheduler
- Example:
a value \${param}
- Example:
- With the parameter setting
scheduler.order.keep_order_content_on_reschedule=true
the values will be substituted only in the first run. - When using node parameters then the Configuration Monitor has to be assigned to the job
- JOE will assign the Configuration Monitor automatically when configuring a node parameter in a job chain
- Should no substitution be performed then please check if the Configuration Monitor is assigned to the job. Otherwise assign parameters individually by using JOE.
Handling of substitution up to release 1.10
FEATURE AVAILABILITY ENDING WITH RELEASE 1.10
- Performance of parameter subsitution is an issue:
- 10 node parameter: 4s
- 20 node parameter: 6s
Handling of substitution starting with release 1.11
FEATURE AVAILABILITY STARTING FROM RELEASE 1.11
- Performance of parameter substitution is restored to a normal range:
- 20 node parameters <= 2s
- - JITL-276Getting issue details... STATUS
Substitution of parameter values by JITL Jobs that extend the JobSchedulerJobAdapter
base class
Some JITL Jobs extend the JobSchedulerJobAdapter
base class and some older jobs extend JobSchedulerJob
. For a detailed list see JITL Jobs - Status.
This article describes the substitution mechanisms for JITL Jobs that extend the JobSchedulerJobAdapter
base class.
Scope of substitution
Substitution is carried out for:
- task parameters and
- order parameters
The following patterns are recognized as parameters to be substituted:
%param%
${param}
Where param
can be
- a task parameter
- an order parameter
- a node parameter
- a JobScheduler parameter
- some special parameter (see below list)
Note: Substitution applies exclusively to the current job run. This means that the values of the parameters will be unchanged after the execution of the job. If you have an order parameter param_x
whose value is value
is ${param_y}
and there are two steps in the job chain, the value of param_x
after the execution of the first node will still be
value
is
${param_y}
Handling of substitution up to release 1.10
FEATURE AVAILABILITY ENDING WITH RELEASE 1.10
Parameters with the name
param
andscheduler_param_param
will be handled as being identical.Parameters with the name
param_plus_any_understrikes
andparamplusanyunderstrikes
will be handled as being identical.
Handling of substitution starting with release 1.11
FEATURE AVAILABILITY STARTING FROM RELEASE 1.11
List of special parameters
Name | Return Value of API Method |
---|---|
SCHEDULER_HOST | spooler.hostname() |
SCHEDULER_TCP_PORT | spooler.tcp_port() |
SCHEDULER_UDP_PORT | spooler.udp_port() |
SCHEDULER_ID | spooler.id() |
SCHEDULER_DIRECTORY | spooler.directory() |
SCHEDULER_CONFIGURATION_DIRECTORY | spooler.configuration_directory() |
SCHEDULER_JOB_CHAIN_NAME | spooler_task.order().job_chain().name() |
SCHEDULER_JOB_CHAIN_TITLE | spooler_task.order().job_chain().title() |
SCHEDULER_ORDER_ID | spooler_task.order().id() |
SCHEDULER_NODE_NAME | getCurrentNodeName(false) |
SCHEDULER_NEXT_NODE_NAME | spooler_task.order().job_chain_node().next_state() |
SCHEDULER_NEXT_ERROR_NODE_NAME | spooler_task.order().job_chain_node().error_state() |
SCHEDULER_JOB_NAME | this.getJobName() |
SCHEDULER_JOB_FOLDER | this.getJobName() |
SCHEDULER_JOB_PATH | this.getJobFolder() + / + this.getJobName() |
SCHEDULER_JOB_TITLE | this.getJobTitle() |
SCHEDULER_TASK_ID | spooler_task.id() |
SCHEDULER_SUPERVISOR_HOST | remoteConfigurationService.hostname() |
SCHEDULER_SUPERVISOR_PORT | remoteConfigurationService.tcp_port() |
References
Change Management References - Agent Usage