Page History
...
Users frequently find a situation when a job creates some a result that which should be forwarded to subsequent jobs in a workflow.
...
Shell jobs can pass results to subsequent jobs:
- by creating a key/value pair with the syntax:
key=value
. - The key/value pair is appended to a temporary file that which is provided by JS7 and that is indicated by the JS7_RETURN_VALUES environment variable.
- The key provided is the name of the order variable that which can be used by subsequent jobs.
- If the variable does not yet exist then it is will be created on-the-fly.
- If the variable exists then the value is will be overwritten
The job script implementation looks like this:
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@rem create results @set first_result=%RANDOM% @set second_result=%RANDOM% @rem pass results from a key/value pair that is appended to a temporary file provided by JS7 @echo firstResult=%first_result% >> %JS7_RETURN_VALUES% @echo secondResult=%second_result% >> %JS7_RETURN_VALUES% |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# create results
$firstResult=Get-Random
$secondResult=Get-Random
# pass results from a key/value pair that is appended to a temporary file provided by JS7
"firstResult=$first_result" | Out-File -File $env:JS7_RETURN_VALUES -Append -Encoding ASCII
"secondResult=$second_result" | Out-File -File $env:JS7_RETURN_VALUES -Append -Encoding ASCII |
Second Job: Read Variables
Shell jobs access order variables and order variables from a mapping to environment variables.
- The JOC Cockpit GUI offers to add allows the mapping to be added per job from the right lower corner with the Environment Variables sub-tab Environment Variables.
- The mapping includes to freely choose free choice of the name of an environment variable that which is used in the job script and to assign an existing order variable.
- The spelling of variable names is case-sensitive.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@rem read results @echo FIRST_RESULT = %FIRST_RESULT% @echo SECOND_RESULT = %SECOND_RESULT% |
...
Scope of Order Variables
The examples above examples create order variables on-the-fly. Such variables can be overwritten by any job or instruction in a workflow.
However, if variables are declared with the workflow, then they are considered arguments that which cannot be overwritten:
- When clicking to Clicking in the background of the middle panel without selecting any object such as a job then , will cause the workflow properties to be shown in the right hand panel shows the workflow properties.
- Workflow properties offer to add variables thatallow variables to be added which:
- can carry no default value: such Such variables are considered mandatory and values have to be added when submitting orders.
- can carry a default value: such Such variables leave it up to the order to provide a value that which would overwrite the default value.
...
Historic Outcome of Order Variables
The examples above examples create order variables on-the-fly. Such variables can be overwritten by any job or instruction in a workflow..
- The JS7 keeps track of the historic outcome of variables with an order's position in the workflow and restores values if a job is repeated. You can make the second job fail and use
- the Resume operation offered by the JOC Cockpit GUI allows the job to be rerun the job with the same values of order variables variable values as before.
- the Resume parameterized operation offered by the JOC Cockpit GUI to modify allows order variables to be modified before rerunning the job.
...
- Most recent values of order variables are displayed and are offered for modificationcan be modified.
- The
returnCode
is a built-in variable that shows the historic value of the predecessor job's return code.
Modifications include to change changing the values of order variables and to modify modifying the order's position in the workflow:
- Drag & Drop the order by holding the red bullet of the failed order and move the order to a different position.
- Drag & Drop operations are limited within a logical scope:
- they allow to select selection of a position within a sequence of jobs and instructions in a workflow.
- they do not allow to jump jumping into a JS7 - Fork / -Join Instruction or other instructions that check an initial condition that which might not be met by the current order.
...