Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

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 ${env_var}, where env_var is the name of an environment variable.
    • The JobScheduler will substitute ${env_var} with an empty value if the environment variable is unknown.
    • For Unix systems case sensitivity is considered for environment variables.
  • 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

Code Block
themeConfluence
languagexml
titleStandalone job substitutes an environement variable
linenumberstrue
collapsetrue
<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>

...

Code Block
languagexml
linenumberstrue
collapsetrue
<?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>
         ...

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:

...

  • 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}
  • 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.

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.

...