Table of Contents |
---|
...
Scope
- This
...
- article describes how the substitution of parameter values works in JobScheduler. It
...
- also
...
- describes how to use parameters in shell
...
- scripts, API Jobs and pre- and postprocessing scripts.
- JobScheduler ships with a Monitor that performs substitution for Node Parameters:
- The current implementation makes use of the following monitor configuration:
<monitor name="configuration_monitor">
<script java_class="com.sos.jitl.jobchainnodeparameter.monitor.JobchainNodeSubstituteMonitor" language="java"/>
</monitor>
- The implementation became available with release 1.11:
Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JITL-276 Display feature availability StartingFromRelease 1.11
- The "classic" implementation makes use of the following configuration monitor:
<monitor name="configuration_monitor">
<script java_class="sos.scheduler.managed.configuration.ConfigurationOrderMonitor" language="java"/>
</monitor>
- The implementation remains available throughout release 1.11 and will be discontinued with release 1.12.
Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JITL-411 Display feature availability EndingWithRelease 1.12 StartingFromRelease 1.6
- The current implementation makes use of the following monitor configuration:
Substitution of parameter values by the JobScheduler
- The JobScheduler substitutes the values of environment variables
...
- in task parameters using
${
...
env_
...
, wherevar}
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
When <env_var>
is an unknown environment variable, JobScheduler substitutes it to empty
...
- can be quoted with a backslash
...
- , i.e. \
${
...
env_
...
var}
- JobScheduler does not substitute environment variables in order parameters.
Example
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
<job name="job_environment"> <params > <param name="param_from_environment" value="the value of scheduler_home is ${SCHEDULER_HOME} ${test}"/> </params> <script language="shell"> <![CDATA[ echo %SCHEDULER_PARAM_PARAM_FROM_ENVIRONMENT% ]]> </script> <monitor name="process0" ordering="0"> <script language="java:javascript"> <![CDATA[ function spooler_process_before(){ spooler_log.info("param_from_environment=" + spooler_task.params.var("param_from_environment")); return true; } ]]> </script> </monitor> <run_time /> </job> |
When running this This job will create the following output will be:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
2015-12-07 10:39:32.458+0100 [info] SCHEDULER-918 state=starting (at=2015-12-07 10:39:32.403+0100) 2015-12-07 10:39:33.984+0100 [info] param_from_environment=the value of scheduler_home is C:/Program Files/sos-berlin.com/jobscheduler/scheduler_current 2015-12-07 10:39:33.987+0100 [info] SCHEDULER-987 Starting process: "C:\WINDOWS\TEMP\\sos-A4CFC1B980.cmd" 2015-12-07 10:39:34.019+0100 [info] [stdout] 2015-12-07 10:39:34.019+0100 [info] [stdout] C:\Users\ur\Documents\sos-berlin.com\jobscheduler\scheduler_current>echo the value of scheduler_home is C:/Program Files/sos-berlin.com/jobscheduler/scheduler_current 2015-12-07 10:39:34.019+0100 [info] [stdout] the value of scheduler_home is C:/Program Files/sos-berlin.com/jobscheduler/scheduler_current |
Please note:
${test}
has been substituted toempty
an empty value as this environment variable has not previously been set.- To access the value of the parameter in a shell script, the parameter name must has to be prefixed. The default value of the prefix is:
SCHEDULER_PARAM_
- Can This prefix can be set by the parameter
scheduler.variable_name_prefix
parameter which is defined configured in the file$scheduler_data/config/scheduler.xml
When changing file. JobScheduler has to be restarted after the value of the prefix , JobScheduler has to be restartethas been changed.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> <?xml-stylesheet type="text/xsl" href="scheduler_documentation.xsl" ?> <spooler> <config mail_xslt_stylesheet="config/scheduler_mail.xsl" port="4102"> <params> <param name="scheduler.variable_name_prefix" value="SCHEDULER_PARAM_"/> <param name="scheduler.order.keep_order_content_on_reschedule" value="false"/> </params> |
Attention: JobScheduler do NOT substitute environment variables in order parameters.
...
... |
Substitution of parameter values
...
by use of the Configuration Monitor
An additional substitution mechanism for jobs For jobs that are running in a job chain there is an add substitution mechanism provided by the preprocessing java class the com.sos.schedulerjitl.jobchainnodeparameter.managed.configuration.ConfigurationOrderMonitor
This preprocessing java class does the following
monitor.JobchainNodeSubstituteMonitor
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
- copy the node paramters that are defined in
jobchain.config.xml
into the file to the order paramtersparameters. - if an order parameter exists with the same name already exits, then it will be overwritten.
- substitution of substitutes all
${<param>param}
variables with:- JobScheduler parameters that are defined configured in the file
$scheduler_data/config/scheduler.xml
file, - task parameters that are defined configured in the actual currently running job,
- order parameters that are defined in configured with the order,
- node paramters parameters that has have been copied to the order parameters.
- JobScheduler parameters that are defined configured in the file
- after After processing
- delete deletes all node parameters from the order.
Please note:
- If a task parameter value should is to be substituted by the configurationMonitor Configuration Monitor then the value has to be quoted with a backslash to avoid the prevent its substitution by the JobScheduler
- Example:
a value \${param}
- Example:
- If With the parameter setting
scheduler.order.keep_order_content_on_reschedule=true
the values will be substituted only in the first run. - when When using node paramters the configurationMonitor must parameters then the Configuration Monitor has to be assigned to the job
- JOE will assign the configurationMontitor Configuration Monitor automatically when defining configuring a node parameter in a job chain
- if substitution does not work, Should no substitution be performed then please check whether if the configuration monitor Configuration Monitor is assigned to the job
- if not make the assignment manually with JOE.
Substituion of parameter values done by JITL-Jobs extending JobSchedulerJobAdapter
- . Otherwise assign parameters individually by using JOE.
Handling of substitution up to release 1.10
Display feature availability | ||
---|---|---|
|
- Performance of parameter substitution is an issue:
- 10 node parameter: 4s
- 20 node parameter: 6s
Handling of substitution starting with release 1.11
Display feature availability | ||
---|---|---|
|
- Performance of parameter substitution is restored to a normal range:
- 20 node parameters <= 2s
Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JITL-276
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.There are JITL-Jobs that extends the base class JobSchedulerJobAdapter
and some older jobs do extend JobSchedulerJob.
Please see a list here JITL Jobs - Status
This article describes the substitution in mechanisms for JITL - Jobs that extend the JobSchedulerJobAdapter
base class.
Scope of substitution
Substitution is carried out for:Substitiution will be executed for
- task parameters and
- order parameters
The following patterns will be are recognized as parameters to be substituted:
%param%
\${param}
§{param}
the Where param
can be:
- a task parameter
- an order parameter
- a node parameter
- scheduler a JobScheduler parameter
- some special values parameter (see below list below)
List of special values:
- )
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
Display feature availability | ||
---|---|---|
|
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
Display feature availability | ||
---|---|---|
|
- No alias parameters as up to release 1.10 are supported.
Jira server SOS JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 6dc67751-9d67-34cd-985b-194a8cdc9602 key JITL-276
List of special parameters
Name | Return Value of API Method | Name | Value |
---|---|---|---|
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() |
- The names
param
andscheduler_param_param
are identically. - The names
param_plus_any_understrikes
andparamplusanyunderstrikes
are identically.
Attention: The substitution is only valid for the actual job run. That means that the values of the parameters will be unsubstituted after the execution of the job. If you have an order parameter param_x
with the value 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 is value is ${param_y}
References
Product Knowledge Base
Change Management References - Agent Usage
Jira | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|