Wait State

The Wait class pauses the branch the state is defined within, until the specified date/time or interval has passed.

For more details on Wait, see the AWS documentation.

class awssl.Wait(Name='', Comment='', InputPath='$', OutputPath='$', EndState=False, NextState=None, WaitForSeconds=None, WaitForSecondsPath=None, WaitUntilISO8601Timestamp=None, WaitUntilISO8601TimestampPath=None)

Wait is a Step Function state that pauses execution of the State Machine for a period of time.

Waits can be durations defined in seconds, or until a specific time. Waits can be non-declarative, and instead use values from the Input data to the state.

One (and only one) method of expressing the wait can be specified in each Wait state.

Either:

  • EndState is True and NextState must be None
  • EndState is False and NextState must be a valid instance of a class derived from StateBase.
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 be None unless EndState is True
  • WaitForSeconds (int) – [Optional] The number of seconds of the wait interval. If specified, this must be a positive integer.
  • WaitForSecondsPath (str) – [Optional] A JSONPath to a wait interval within the Input data provided to the state.
  • WaitUntilISO8601Timestamp (str) – [Optional] A datetime string that conforms to the RFC3339 profile of ISO 8601.
  • WaitUntilISO8601TimestampPath (str) – [Optional] A JSONPath to a datetime string that conforms to the RFC3339 profile of ISO 8601, within the Input data provided to the state.
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:Wait – A new instance of this instance and any other instances in its branch.
get_wait_seconds()

Returns the wait interval in seconds.

Returns:int – The wait interval
get_wait_seconds_path()

Returns the JSON Path with which to resolve the wait interval from the Input data supplied to the state.

Returns:str
get_wait_timestamp()

Returns a timestamp as the RFC3339 profile of ISO 8601. The wait will stop its branch of the StateMachine until this time has passed

Returns:str
get_wait_timestamp_path()

Returns the JSON Path with which to resolve the wait date/time from the Input data supplied to the state.

Returns:str
set_wait_seconds(WaitForSeconds=1)

Sets the wait interval in seconds.

The interval must be a positive integer if specifed. Default value is 1 second.

Parameters:WaitForSeconds (int) – [Optional] The number of seconds of the wait interval. If specified, this must be a positive integer.
set_wait_seconds_path(WaitForSecondsPath=None)

Sets the JSON Path with which to resolve the wait interval from the Input data supplied to the state.

Parameters:WaitForSecondsPath (str) – [Optional] A JSONPath to a wait interval within the Input data provided to the state.
set_wait_timestamp(WaitUntilISO8601Timestamp)

Sets a date/time of the format RFC3339 profile of ISO 8601. The wait will stop its branch of the StateMachine until this time has passed

Parameters:WaitUntilISO8601Timestamp (str) – [Optional] A datetime string that conforms to the RFC3339 profile of ISO 8601.
set_wait_timestamp_path(WaitUntilISO8601TimestampPath=None)

Sets a JSON Path of a date/time of the format RFC3339 profile of ISO 8601, which will be retrieved from the Input data passed to the state.

The wait will stop its branch of the StateMachine until this time has passed

Parameters:WaitUntilISO8601TimestampPath – [Optional] A JSONPath to a datetime string that conforms to the RFC3339 profile of ISO 8601, within the Input data provided to the state.
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 is incorrectly defined.