...
- Environment variables are used to make job (i.e. task) and order parameters accessible to shell scripts in subsequent jobs.
- Environment variables are named using a predefined prefix and the name of the original parameter:
- Environment variable names are written with uppercase letters.
- The default value for the environment variable prefix is SCHEDULER_PARAM_ .
- For example, a task parameter param1 can be accessed by the SCHEDULER_PARAM_PARAM1 environment variable name.
If the SCHEDULER_PARAM_ prefix is not to be used for the environment variables and instead the parameter names themselves are to be used then the following setting can be added to the
./config/scheduler.xml
file:Code Block language xml <params> <param name="scheduler.variable_name_prefix" value="*NONE"/> ... </param>
Note that: there is a risk of JobScheduler overwriting already existing environment variables with new ones of the same name that have been derived from job or order parameters if a prefix such as SCHEDULER_PARAM_ is not used.For details see Which environment variables are provided by JobScheduler?
Examples
The following two examples show a task parameter defined in a job <param> tag can be called in a shell script.
...
- JobScheduler parses a temporary file for name/value pairs each time the status of a job chain changes.
- The name of this temporary file is held in the SCHEDULER_RETURN_VALUES environment variable.
- The name/value pairs are automatically added as order parameters.
- A parameter set in one job shell script can be written to this temporary file and made available to subsequent jobs using the following (for Windows):
myParam=myValue >> %SCHEDULER_RETURN_VALUES%
- A task parameter set in one job can be written to this temporary file and thereby made available to subsequent jobs in a job chain using the following (for Windows):
myParam=%SCHEDULER_PARAM_MYPARAM% >> %SCHEDULER_RETURN_VALUES%
- A parameter set in one job is called in the shell script of a subsequent job using the following (for Windows):
echo myParam = %SCHEDULER_PARAM_MYPARAM%
...
Code Block | ||||
---|---|---|---|---|
| ||||
<job order="yes" stop_on_error="no" name="job2_shell_with_parameter_get">
<params>
<param name="param1" value="Value1-Job2" />
<param name="param2" value="Value2-Job2" />
</params>
<script language="shell">
<![CDATA[
echo param1 has the value: %SCHEDULER_PARAM_PARAM1%
echo param2 has the value: %SCHEDULER_PARAM_PARAM2%
echo param3 has the value: %SCHEDULER_PARAM_PARAM3%
echo SCHEDULER_RETURN_VALUES = %SCHEDULER_RETURN_VALUES%
]]>
</script>
<run_time/>
</job>
|
...
- How to set and read job and order parameters
- How to access order parameters and job parameters using the JobScheduler API How to pass parameters to subsequent shell jobs in a job chain
- How to dynamically use node parameters and internal parameter substitution
- How to clone parameters from a persistent order
...