Extension: BranchRetryParallel State¶
The BranchRetryParallel class extends the Parallel state.
Parallel supports retrying the state if one or more of its branches generates an error that is included in the Retrier list. This class extends this behaviour, allowing the branches to define errors that can be retried before the whole state is retried.
This extension can ensure that an intermittent failure on a single branch does not trigger significant unnecessary reprocessing of the successful branches.
For more details on Parallel, see the AWS documentation.
-
class
awssl.ext.BranchRetryParallel(Name=None, Comment='', InputPath='$', OutputPath='$', NextState=None, EndState=None, ResultPath='$', RetryList=None, CatcherList=None, BranchList=None, BranchRetryList=None)¶ Extends the Parallel state, providing optional retries on each branch separately.
Either:
EndStateisTrueandNextStatemust beNoneEndStateisFalseandNextStatemust be a valid instance of a class derived fromStateBase.
Output is returned as a
listof the outputs from each branch, as withParallel.Parameters: - Name (str) – [Required] The name of the state within the branch of the state machine
- Comment (str) – [Optional] A comment describing the intent of this pass state
- InputPath (str) – [Optional] Filter on the Input information to be passed to the Pass state. Default is “$”, signifying that all the Input information will be provided
- OutputPath (str) – [Optional] Filter on the Output information to be returned from the Pass state. Default is “$”, signifying that all the result information will be provided
- EndState (bool) – [Optional] Flag indicating if this state terminates a branch of the state machine. Defaults to
False - NextState (instance of class derived from
StateBase) – [Optional] Next state to be invoked within this branch. Must not beNoneunlessEndStateisTrue - ResultPath (str) – [Optional] JSONPath indicating where results should be added to the Input. Defaults to “$”, indicating results replace the Input entirely.
- RetryList – [Optional]
listofRetrierinstances corresponding to error states that cause the entire set of branches to be retried - CatcherList – [Optional]
listofCatcherinstances corresponding to error states that can be caught and handled by further states being executed in theStateMachine. - BranchList – [Required]
listofStateBaseinstances, providing the starting states for each branch to be run concurrently - BranchRetryList – [Optional]
listofRetrierinstances corresponding to error states that can be retried for each branch
Type: RetryList: list of
RetrierType: CatcherList: list of
CatcherType: BranchList: list of
StateBaseType: BranchRetryList: list of
StateBase-
clone(NameFormatString='{}')¶ Returns a clone of this instance, with the clone named per the NameFormatString, to avoid state name clashes.
If this instance is not an end state, then the next state will also be cloned, to establish a complete clone of the branch form this instance onwards.
Parameters: NameFormatString (str) – [Required] The naming template to be applied to generate the name of the new instance. Returns: BranchRetryParallel– A new instance of this instance and any other instances in its branch.
-
get_branch_list()¶ Returns the list of starting states for each branch to be executed concurrently
Returns: listofStateBaseinstances
-
get_branch_retry_list()¶ Returns the list of
Retrierinstances that will be applied to each branch separately, allowing failure in one branch to be retried without having to re-execute all the branches of theParallel.Returns: listofRetrierinstances
-
set_branch_list(BranchList=None)¶ Sets the list of starting states for each branch to be executed concurrently.
At least one branch is required for the state to be valid.
Parameters: BranchList – [Required] listofStateBaseinstances, providing the starting states for each branch to be run concurrentlyType: BranchList: list of StateBase
-
set_branch_retry_list(BranchRetryList=None)¶ Sets the list of
Retrierinstance to be applied to the branches in theParallel.If none are set, then the behaviour of this state is equivalent to the
Parallelstate.Parameters: BranchRetryList – [Optional] listofRetrierinstances corresponding to error states that can be retried for each branchType: BranchRetryList: list of StateBase
-
to_json()¶ Returns the JSON representation of this instance.
Returns: dict – The JSON representation
-
validate()¶ Validates this instance is correctly specified.
Raises
Exceptionwith details of the error, if the state machine is incorrectly defined.