You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

Introduction

Parameters can be set for jobs and orders.

Note that when jobs are programmed using the JobScheduler API, job and order parameters are separate objects. Node and order parameters form the same object, although here node parameters have priority over order parameters of the same name.

Order parameters are available to all the jobs in a job chain. When the value of an order parameter in a job chain changes then this changed value will be applied at the start of the next (persistent) order.

Setting Parameters for a Job or an Order

The Parameter function can be found in the JOE element tree as a sub-element of every Job and Order. Each
parameter consists of a name and a value. Enter the name-value pairs in the Name and Value fields.

Reading and Setting Parameters in Shell Scripts

An environment variable of the form:

  • $SCHEDULER_PARAM_[PARAM-NAME] (Unix™)
  • %SCHEDULER_PARAM_[PARAM-NAME]% (Windows™)
    can be used to read any parameter in a shell script.

Parameters in a shell script can be added and modified using:

  • echo "[PARAM-NAME]=[PARAM-VALUE]" >> $SCHEDULER_RETURN_VALUES (on Unix™ systems)
  • echo [PARAM-NAME]=[PARAM-VALUE] >> %SCHEDULER_RETURN_VALUES% (on Windows™ systems)
    Check to see if the testParam parameter, described in the last chapter (page 28), has been set. As an example of the reading and writing of parameters, modify the scripts of the quickstart/firstOrderJob and quickstart/secondOrderJob Jobs as follows:

     @echo off
     echo %SCHEDULER_JOB_NAME% processed %SCHEDULER_ORDER_ID%
     echo Current Timestamp: %DATE% %TIME%
     echo Parameter testParam = "%SCHEDULER_PARAM_TESTPARAM%"
     echo Parameter testParam is modified to "123456789"
     echo testParam=123456789 >> %SCHEDULER_RETURN_VALUES%
     exit %ERRORLEVEL%
    

Example: firstOrderJob for Windows™:

 #!/bin/sh
 echo "$SCHEDULER_JOB_NAME processed $SCHEDULER_ORDER_ID"
 echo "Current Timestamp: `date`"
 echo "Parameter testParam = \"$SCHEDULER_PARAM_TESTPARAM\""
 echo "Parameter testParam is modified to \"123456789\""
 echo "testParam=123456789" >> $SCHEDULER_RETURN_VALUES
 exit $?

Example: firstOrderJob for Unix™:

 @echo off
 echo %SCHEDULER_JOB_NAME% processed %SCHEDULER_ORDER_ID%
 echo Parameter testParam = "%SCHEDULER_PARAM_TESTPARAM%"
 dir .\config\live\quickstart
 exit %ERRORLEVEL%

Example: secondOrderJob for Windows™:

 #!/bin/sh
 echo "$SCHEDULER_JOB_NAME processed $SCHEDULER_ORDER_ID"
 echo "Parameter testParam = \"$SCHEDULER_PARAM_TESTPARAM\""
 ls -l ./config/live/quickstart
 exit $?

Example: secondOrderJob for Unix™:

Both Jobs read the testParam parameter, whilst the quickstart/firstOrderJob Job changes the value of the
parameter. testParamHello World! is the initial parameter setting for the quickstart/firstOrderJob Job. This value will be overridden by the Order

Now start the Order for the quickstart/firstJobChain Chain in JOC and follow its progress in the log file.

Further information

 

  • No labels