Versions Compared

Key

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

Table of Contents

Introduction

This documentation article describes how the substitution of parameter values works in JobScheduler. It is also described how to use parameters in shell script, API Jobs and pre- and postprocessing scripts.

Substitution of parameter values

...

bythe  JobScheduler

The JobScheduler substitutes can substitute the values of environment variables when in task parameters using ${<env_var>}in task parameters.

When <env_var> is an unknown environment variable, JobScheduler substitutes it to empty

...

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>


When running this This job will produce the following output will bewhen running:

Code Block
languagetext
collapsetrue
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 

...

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>

 

AttentionNote: JobScheduler do does NOT substitute environment variables in order parameters.

           

Substitution of parameter values

...

by sos.scheduler.managed.configuration.ConfigurationOrderMonitor

For jobs that are running in a job chain there is an An add substitution mechanism provided by the preprocessing java class the  sos.scheduler.managed.configuration.ConfigurationOrderMonitor preprocessing java class for jobs that are running in a job chain:

 

This preprocessing java class does the following:

  • before processing:
    • copy the node paramters parameters that are defined in jobchain.config.xml into the the order paramtersparameters
    • if an order parameter with the same name already exitsexists, it will be overwritten
    • substitution of all ${<param>} with:
      • JobScheduler parameters that are defined in the file $scheduler_data/config/scheduler.xml file.
      • task parameters that are defined in the actual running job
      • order parameters that are defined in the order
      • node paramters parameters that has been copied to the order parameters
  • after processing:
    • delete all node parameters from the order.

...

  • If a task parameter value should be substituted by the configurationMonitor the value has to be quoted with a backslash to avoid the substitution by the JobScheduler
    • Example: a value \${param}
  • If the parameter scheduler.order.keep_order_content_on_reschedule=true the values will be substituted only in the first run.
  • when using node paramters parameters the configurationMonitor must be assigned to the job
    • JOE will assign the configurationMontitor automatically when defining a node parameter in a job chain
    • if substitution does not work, please check whether the configuration monitor is assigned to the job
      • if not make the assignment manually with JOE.

 

...

Substitution of parameter values

...

by JITL

...

Jobs

...

that extend the JobSchedulerJobAdapter base class

There are Some JITL-Jobs that extends extend the JobSchedulerJobAdapter base class JobSchedulerJobAdapter and some older jobs do extend JobSchedulerJob. Please see For a detailed list see here: JITL Jobs - Status

This article describes the substitution in JITL-Jobs that extend the JobSchedulerJobAdapter base class.

Substitiution will be executed is carried out for

  • task parameters
  • order parameters

The following patterns will be are recognized as parameters to be substituted

  • %param%
  • ${param}
  • §{param}

the The param can be:

  • a task parameter
  • a order parameter
  • a node parameter
  • a scheduler parameter
  • some special values (see the list below)

List of special values:

...

  • The names param  and scheduler_param_param are identicallyidentical.
  • The names param_plus_any_understrikes  and  paramplusanyunderstrikes are identically.identical.
  • Parameters with  names in the following forms will be handled identically:
    • myparam  and scheduler_param_myparam, and
    • myparam_plus_any_understrikes  and  myparamplusanyunderstrikes 

Note: Substitution only applies for the current 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 whose 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 iswill be ${param_y}