Retrier¶
The Retrier
class defines how to respond to a failure in a Task
or Parallel
execution.
For more details on Retrier
, see the AWS documentation.
-
class
awssl.
Retrier
(ErrorNameList=None, IntervalSeconds=1, MaxAttempts=3, BackoffRate=2.0)¶ Models a Retrier for a “Retry” field in a Task or Parallel state
Parameters: - ErrorNameList (list of str) – [Required] The set of error names that this
Retrier
will handle. - IntervalSeconds (int) – [Optional] The interval in seconds before retrying the state. Default is 1 second.
- MaxAttempts (int) – [Optional] The maximum number of retry attempts. Default is 3.
- BackoffRate (float) – [Optional] The growth rate in retry interval. Must be greater than 1.0. Default is 2.0.
-
clone
()¶ Returns a clone of this instance.
Returns: Retrier
– A new instance of this instance and any other instances in its branch.
-
get_backoff_rate
()¶ Returns the backoff rate that will be applied to the
IntervalSeconds
on each retry.Returns: float – The backoff rate for the IntervalSeconds
.
-
get_error_name_list
()¶ Returns the
list
of error names that this instance will handle.Returns: list of str – The list of error names
-
get_interval_seconds
()¶ Returns the interval in seconds before the state machine will retry the associated failed state.
Returns: int – The interval in seconds before retrying.
-
get_max_attempts
()¶ Returns the maximum number of retry attempts of the associated failed state.
Returns: int – The maximum number of retry attempts.
-
set_backoff_rate
(BackoffRate=2.0)¶ Sets the backoff rate that will be applied to the
IntervalSeconds
after the first retry.The backoff rate must be >= 1.0. Default is 2.0.
Parameters: BackoffRate (float) – [Optional] The growth rate in retry interval.
-
set_error_name_list
(ErrorNameList)¶ Sets the
list
of error names that this instance will handle.ErrorNameList
must not beNone
, and must be a non-emptylist
ofstr
.Parameters: ErrorNameList (list of str) – [Required] The set of error names that this Retrier
will handle.
-
set_interval_seconds
(IntervalSeconds=1)¶ Sets the interval in seconds before the state machine will retry the associated failed state.
The interval must be >= 1 second. Default is 1 second.
Parameters: IntervalSeconds (int) – [Optional] The interval in seconds before retrying the state.
-
set_max_attempts
(MaxAttempts=3)¶ Sets the maximum number of retry attempts of the associated failed state.
The max attempts must be greater than or equal to zero. A value of zero indicates that no retry will be attempted. The default is 3.
Parameters: MaxAttempts (int) – [Optional] The maximum number of retry attempts.
-
to_json
()¶ Returns the JSON representation of this instance.
Returns: dict – The JSON representation
-
validate
()¶ Validates this instance is correctly specified.
Raises
Exception
with details of the error, if the state machine is incorrectly defined.
- ErrorNameList (list of str) – [Required] The set of error names that this