Introduction
- The Retry Instruction adds error handling to one or more job nodes and other instructions in a workflow.
- If one of the jobs in the Retry block fails, then the order is moved to the begin of the Retry block to repeat execution.
- Users can specify a limited number of tries and the respective delays for the Retry Instruction. If the maximum number of tries is reached and a job in the Retry block fails, then the order is considered to be failed.
- Users can specify an unlimited number of tries which will immediately retry execution from the begin of the Retry block.
Workflow Instruction: Retry
- Download Workflow Example (.json upload): pdwRetry.workflow.json
Explanation:
- If any of the three jobs within the Retry block fails, then the order will wait for the specified delay and then repeat the Retry block from the first job node in the block.
- The example makes use of a maximum of 10 tries and an individual delay, which is lengthened by 10 seconds with each try.
- If the number of delays specified is lower than the number of tries then the last delay specified will be used for subsequent tries.
Use of Retry Variables
FEATURE AVAILABILITY STARTING FROM RELEASE 2.7.2
Users who wish to programmatically use variables that indicate the maximum number of tries and the current try counter can use the built-in variables
$js7MaxTries
: maximum number of tries as configured with the Retry Instruction..- For an unlimited number of tries the variable returns the empty value.
- The variable is not defined outside of a Retry Instruction block.
$js7TryCount
: current number of tries. The variable holds the 0 value when used outside of a Retry Instruction block.
The variables can be used in an JS7 - If Instruction and they can be mapped to environment variables in a shell job like this:
Explanation:
- The
$js7MaxTries
variable is mapped to theMAX_TRIES
environment variable. - The
$js7TryCount
variable is mapped to theTRY_COUNT
environment variable.
Environment variables can be used in shell jobs for Unix using $MAX_TRIES
and $TRY_COUNT
syntax. In shell jobs for Windows the %MAX_TRIES%
and %TRY_COUNT%
syntax is used.
Resources
How To ... Instructions
Overview
Content Tools