...
- Welche Rolle ist für den Fall verantwortlich? Wer will etwas? Engineering, Operating, Business
- Was ist das Ziel? Was ist das Mittel? Was ist die Motivation?
Start one or multiple job chains
Start multiple job chains ( split and sync back ) <
Status | ||||||
---|---|---|---|---|---|---|
|
Assign Unique Order IDs
Parameter handling
Example Exit code range
Example: Starting an order
...
according to the exit code returned by a job chain node
Demonstration Files
Download: JobChainReturnCodes Example working example ( Windows Version ), for Linux simply change the job's shell scripts with Linux scripts.
Example
Consider two job chains where one of the Consider two job chains where one of the chains will only be started if a job in the other chain has beens successfully completed.
...
- JobChain0 has 6 shell jobs 1, 2 ,3, 4, 5 and 6 and JobChain1 has 2 shell jobs.
- JobChain1 should only start if Job 3 in JobChain0 ends successfully.
Configuration return codes
The configuration of the exit codes takes place in two stages:
- The standard progression through the job chains:
- When any of the jobs in either chain ends with an exit code = 0 (i.e. successfully) it will proceed to the job defined by the next_state.
- When any of the jobs ends with an exit code other than 0 (i.e. in error) then processing of the order will stopped and the chain will go to the error_state.
- Generation of the order to start JobChain1:
- If Job 3 ends with an exit code = 0 then the Order 1 for
- JobChain1 will be generated by JobScheduler and started.
...
- This in configured using on_return_codes.
- This in configured using on_return_codes.
Configuring the return codes
This is done in the Nodes tab of the JobScheduler Object Editor JOE for JobChain0 as shown in Screenshot 1 below.
A more detailed description ....
Status | ||||
---|---|---|---|---|
|
- The standard progression through the job chains is configured in the NextState and ErrorState fields of the form.
- Generation of the order to start JobChain1 is configured as shown in the screenshot:
- 1) Select Job3 since we want to start JobChain1 if this job ends successfully
- 2) Click on the Return Codes button to open the Return Code configuration form
Screenshot 1
- 1) Give the return code e.g
. return_code = 0
is success in the ReturnCodes field- Note that another return code can be used but that this will be seen as an error in the originating job chain.
- 2), 3) Select the target job chain e.g. JobChain1 from the drop down list ( only job chains present the same folder will be available in the dropdown list )
- 4) Click on Add Order button to assign the an Order to the
JobChain1
- 5) Click on Apply (at the foot of the form)to make the changes in the job chain configuration
- Save the job chain configuration.
Screenshot 2
Code Block | ||||
---|---|---|---|---|
| ||||
<job_chain title="JobChain0">
<job_chain_node error_state="Error" job="Job1" next_state="2" state="1"/>
<job_chain_node error_state="Error" job="Job2" next_state="3" state="2"/>
<job_chain_node error_state="Error" job="Job3" next_state="4" state="3">
<on_return_codes>
<on_return_code return_code="0">
<add_order xmlns="https://jobscheduler-plugins.sos-berlin.com/NodeOrderPlugin" job_chain="Chain1"/>
</on_return_code>
</on_return_codes>
</job_chain_node>
<job_chain_node error_state="Error" job="Job4" next_state="5" state="4"/>
<job_chain_node error_state="Error" job="Job5" next_state="6" state="5"/>
<job_chain_node error_state="Error" job="Job6" next_state="Success" state="6"/>
<job_chain_node state="Success"/>
<job_chain_node state="Error"/>
</job_chain> |
...
This can be achieved by configuring the return code for the job node
- Screenshot 1 : Open
JobChain0
in the JobScheduler Object Editor, JOE - Screenshot 1: Select
Job 3
, since we want to start theJobChain1
after if theJob3
ends successfully - Screenshot 2 : Give the return code e.g
. return code = 0
is success in the ReturnCodes text filed - Screenshot 2 : Select the target job chain e.g.
JobChain1
from the drop down list ( only job chains present the same folder will be available in the dropdown list ) - Screenshot 2 : Click on Add Order button to assign the an Order to the
JobChain1
- Screenshot 2 : Click on Apply to make the changes in the job chain configuration
- Screenshot 2 : Save your job chain configuration.
Screenshot 1
Screenshot 2
...
Example Files
Download: JobChainReturnCodes Example working example ( Windows Version ), for Linux simply change the job's shell scripts with Linux scripts scripts.
2nd Example
Status | ||||||
---|---|---|---|---|---|---|
|
Workflow within Job Chain & Error handling
Delimitation
Status | ||||||
---|---|---|---|---|---|---|
|
Workflow in the event of error is possible but does not suppress the error:
- If If an order for another job chain is to be generated in the event of an error occurring in a job ->
- If alternative job chains are to be started depending on the return code (OR) then only one of the alternatives can not result in an error (only one success code poss)
Use Cases
Status | ||||
---|---|---|---|---|
|
Start one or multiple job chains
Start multiple job chains ( split and sync back ) <
Status | ||||||
---|---|---|---|---|---|---|
|
Assign Unique Order IDs
Parameter handling
Example Exit code range
References
- Change Management References
- JIRA Issues
- JobScheduler Reference Documentation:
- XML Element in der Referenzdokumentation
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
...
- Abgrenzungen, was ein Feature nicht leistet, z.B. nur für bestimmten Plattformen verfügbar
- Funktionalität, die eben nicht bereitgestellt wird
- Limitation (technische Beschränkungen)
Example
- Beispiel Code und Erläuterungen
- Code Beispiel via Confluence Code Macro
- Beispiel Objekte
- Ganze Objekte wie jobs, orders etc nur als Anhang
...