SFN / Client / list_executions

list_executions#

SFN.Client.list_executions(**kwargs)#

Lists all executions of a state machine or a Map Run. You can list all executions related to a state machine by specifying a state machine Amazon Resource Name (ARN), or those related to a Map Run by specifying a Map Run ARN. Using this API action, you can also list all redriven executions.

You can also provide a state machine alias ARN or version ARN to list the executions associated with a specific alias or version.

Results are sorted by time, with the most recent execution first.

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

Note

This operation is eventually consistent. The results are best effort and may not reflect very recent updates and changes.

This API action is not supported by EXPRESS state machines.

See also: AWS API Documentation

Request Syntax

response = client.list_executions(
    stateMachineArn='string',
    statusFilter='RUNNING'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'ABORTED'|'PENDING_REDRIVE',
    maxResults=123,
    nextToken='string',
    mapRunArn='string',
    redriveFilter='REDRIVEN'|'NOT_REDRIVEN'
)
Parameters:
  • stateMachineArn (string) –

    The Amazon Resource Name (ARN) of the state machine whose executions is listed.

    You can specify either a mapRunArn or a stateMachineArn, but not both.

    You can also return a list of executions associated with a specific alias or version, by specifying an alias ARN or a version ARN in the stateMachineArn parameter.

  • statusFilter (string) – If specified, only list the executions whose current execution status matches the given filter.

  • maxResults (integer) –

    The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 100 and the maximum allowed page size is 1000. A value of 0 uses the default.

    This is only an upper limit. The actual number of results returned per call might be fewer than the specified maximum.

  • nextToken (string) – If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

  • mapRunArn (string) –

    The Amazon Resource Name (ARN) of the Map Run that started the child workflow executions. If the mapRunArn field is specified, a list of all of the child workflow executions started by a Map Run is returned. For more information, see Examining Map Run in the Step Functions Developer Guide.

    You can specify either a mapRunArn or a stateMachineArn, but not both.

  • redriveFilter (string) –

    Sets a filter to list executions based on whether or not they have been redriven.

    For a Distributed Map, redriveFilter sets a filter to list child workflow executions based on whether or not they have been redriven.

    If you do not provide a redriveFilter, Step Functions returns a list of both redriven and non-redriven executions.

    If you provide a state machine ARN in redriveFilter, the API returns a validation exception.

Return type:

dict

Returns:

Response Syntax

{
    'executions': [
        {
            'executionArn': 'string',
            'stateMachineArn': 'string',
            'name': 'string',
            'status': 'RUNNING'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'ABORTED'|'PENDING_REDRIVE',
            'startDate': datetime(2015, 1, 1),
            'stopDate': datetime(2015, 1, 1),
            'mapRunArn': 'string',
            'itemCount': 123,
            'stateMachineVersionArn': 'string',
            'stateMachineAliasArn': 'string',
            'redriveCount': 123,
            'redriveDate': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • executions (list) –

      The list of matching executions.

      • (dict) –

        Contains details about an execution.

        • executionArn (string) –

          The Amazon Resource Name (ARN) that identifies the execution.

        • stateMachineArn (string) –

          The Amazon Resource Name (ARN) of the state machine that ran the execution.

        • name (string) –

          The name of the execution.

          A name must not contain:

          • white space

          • brackets < > { } [ ]

          • wildcard characters ? *

          • special characters " # % \ ^ | ~ ` $ & , ; : /

          • control characters ( U+0000-001F, U+007F-009F)

          To enable logging with CloudWatch Logs, the name should only contain 0-9, A-Z, a-z, - and _.

        • status (string) –

          The current status of the execution.

        • startDate (datetime) –

          The date the execution started.

        • stopDate (datetime) –

          If the execution already ended, the date the execution stopped.

        • mapRunArn (string) –

          The Amazon Resource Name (ARN) of a Map Run. This field is returned only if mapRunArn was specified in the ListExecutions API action. If stateMachineArn was specified in ListExecutions, the mapRunArn isn’t returned.

        • itemCount (integer) –

          The total number of items processed in a child workflow execution. This field is returned only if mapRunArn was specified in the ListExecutions API action. If stateMachineArn was specified in ListExecutions, the itemCount field isn’t returned.

        • stateMachineVersionArn (string) –

          The Amazon Resource Name (ARN) of the state machine version associated with the execution.

          If the state machine execution was started with an unqualified ARN, it returns null.

          If the execution was started using a stateMachineAliasArn, both the stateMachineAliasArn and stateMachineVersionArn parameters contain the respective values.

        • stateMachineAliasArn (string) –

          The Amazon Resource Name (ARN) of the state machine alias used to start an execution.

          If the state machine execution was started with an unqualified ARN or a version ARN, it returns null.

        • redriveCount (integer) –

          The number of times you’ve redriven an execution. If you have not yet redriven an execution, the redriveCount is 0. This count is only updated when you successfully redrive an execution.

        • redriveDate (datetime) –

          The date the execution was last redriven.

    • nextToken (string) –

      If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

Exceptions

  • SFN.Client.exceptions.InvalidArn

  • SFN.Client.exceptions.InvalidToken

  • SFN.Client.exceptions.StateMachineDoesNotExist

  • SFN.Client.exceptions.StateMachineTypeNotSupported

  • SFN.Client.exceptions.ValidationException

  • SFN.Client.exceptions.ResourceNotFound