SFN

Table of Contents

Client

class SFN.Client

A low-level client representing AWS Step Functions (SFN):

client = session.create_client('stepfunctions')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
create_activity(**kwargs)

Creates an activity. An activity is a task which you write in any programming language and host on any machine which has access to AWS Step Functions. Activities must poll Step Functions using the GetActivityTask API action and respond using SendTask* API actions. This function lets Step Functions know the existence of your activity and returns an identifier for use in a state machine and when polling from the activity.

See also: AWS API Documentation

Request Syntax

response = client.create_activity(
    name='string'
)
Parameters
name (string) --

[REQUIRED]

The name of the activity to create. This name must be unique for your AWS account and region for 90 days. For more information, see Limits Related to State Machine Executions in the AWS Step Functions Developer Guide .

A name must not contain:

  • whitespace
  • brackets `` { } [ ]``
  • wildcard characters ? *
  • special characters " # % \ ^ | ~ ` $ , ; : /
  • control characters (U+0000-001F , U+007F-009F )
Return type
dict
Returns
Response Syntax
{
    'activityArn': 'string',
    'creationDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --
    • activityArn (string) --

      The Amazon Resource Name (ARN) that identifies the created activity.

    • creationDate (datetime) --

      The date the activity is created.

create_state_machine(**kwargs)

Creates a state machine. A state machine consists of a collection of states that can do work (Task states), determine to which states to transition next (Choice states), stop an execution with an error (Fail states), and so on. State machines are specified using a JSON-based, structured language.

See also: AWS API Documentation

Request Syntax

response = client.create_state_machine(
    name='string',
    definition='string',
    roleArn='string'
)
Parameters
  • name (string) --

    [REQUIRED]

    The name of the state machine. This name must be unique for your AWS account and region for 90 days. For more information, see Limits Related to State Machine Executions in the AWS Step Functions Developer Guide .

    A name must not contain:

    • whitespace
    • brackets `` { } [ ]``
    • wildcard characters ? *
    • special characters " # % \ ^ | ~ ` $ , ; : /
    • control characters (U+0000-001F , U+007F-009F )
  • definition (string) --

    [REQUIRED]

    The Amazon States Language definition of the state machine.

  • roleArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the IAM role to use for this state machine.

Return type

dict

Returns

Response Syntax

{
    'stateMachineArn': 'string',
    'creationDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • stateMachineArn (string) --

      The Amazon Resource Name (ARN) that identifies the created state machine.

    • creationDate (datetime) --

      The date the state machine is created.

delete_activity(**kwargs)

Deletes an activity.

See also: AWS API Documentation

Request Syntax

response = client.delete_activity(
    activityArn='string'
)
Parameters
activityArn (string) --

[REQUIRED]

The Amazon Resource Name (ARN) of the activity to delete.

Return type
dict
Returns
Response Syntax
{}

Response Structure

  • (dict) --
delete_state_machine(**kwargs)

Deletes a state machine. This is an asynchronous operation: It sets the state machine's status to DELETING and begins the deletion process. Each state machine execution is deleted the next time it makes a state transition.

Note

The state machine itself is deleted after all executions are completed or deleted.

See also: AWS API Documentation

Request Syntax

response = client.delete_state_machine(
    stateMachineArn='string'
)
Parameters
stateMachineArn (string) --

[REQUIRED]

The Amazon Resource Name (ARN) of the state machine to delete.

Return type
dict
Returns
Response Syntax
{}

Response Structure

  • (dict) --
describe_activity(**kwargs)

Describes an activity.

See also: AWS API Documentation

Request Syntax

response = client.describe_activity(
    activityArn='string'
)
Parameters
activityArn (string) --

[REQUIRED]

The Amazon Resource Name (ARN) of the activity to describe.

Return type
dict
Returns
Response Syntax
{
    'activityArn': 'string',
    'name': 'string',
    'creationDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --
    • activityArn (string) --

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

    • name (string) --

      The name of the activity.

      A name must not contain:

      • whitespace
      • brackets `` { } [ ]``
      • wildcard characters ? *
      • special characters " # % \ ^ | ~ ` $ , ; : /
      • control characters (U+0000-001F , U+007F-009F )
    • creationDate (datetime) --

      The date the activity is created.

describe_execution(**kwargs)

Describes an execution.

See also: AWS API Documentation

Request Syntax

response = client.describe_execution(
    executionArn='string'
)
Parameters
executionArn (string) --

[REQUIRED]

The Amazon Resource Name (ARN) of the execution to describe.

Return type
dict
Returns
Response Syntax
{
    'executionArn': 'string',
    'stateMachineArn': 'string',
    'name': 'string',
    'status': 'RUNNING'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'ABORTED',
    'startDate': datetime(2015, 1, 1),
    'stopDate': datetime(2015, 1, 1),
    'input': 'string',
    'output': 'string'
}

Response Structure

  • (dict) --
    • executionArn (string) --

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

    • stateMachineArn (string) --

      The Amazon Resource Name (ARN) of the executed stated machine.

    • name (string) --

      The name of the execution.

      A name must not contain:

      • whitespace
      • brackets `` { } [ ]``
      • wildcard characters ? *
      • special characters " # % \ ^ | ~ ` $ , ; : /
      • control characters (U+0000-001F , U+007F-009F )
    • status (string) --

      The current status of the execution.

    • startDate (datetime) --

      The date the execution is started.

    • stopDate (datetime) --

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

    • input (string) --

      The string that contains the JSON input data of the execution.

    • output (string) --

      The JSON output data of the execution.

      Note

      This field is set only if the execution succeeds. If the execution fails, this field is null.

describe_state_machine(**kwargs)

Describes a state machine.

See also: AWS API Documentation

Request Syntax

response = client.describe_state_machine(
    stateMachineArn='string'
)
Parameters
stateMachineArn (string) --

[REQUIRED]

The Amazon Resource Name (ARN) of the state machine to describe.

Return type
dict
Returns
Response Syntax
{
    'stateMachineArn': 'string',
    'name': 'string',
    'status': 'ACTIVE'|'DELETING',
    'definition': 'string',
    'roleArn': 'string',
    'creationDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --
    • stateMachineArn (string) --

      The Amazon Resource Name (ARN) that identifies the state machine.

    • name (string) --

      The name of the state machine.

      A name must not contain:

      • whitespace
      • brackets `` { } [ ]``
      • wildcard characters ? *
      • special characters " # % \ ^ | ~ ` $ , ; : /
      • control characters (U+0000-001F , U+007F-009F )
    • status (string) --

      The current status of the state machine.

    • definition (string) --

      The Amazon States Language definition of the state machine.

    • roleArn (string) --

      The Amazon Resource Name (ARN) of the IAM role used when creating this state machine. (The IAM role maintains security by granting Step Functions access to AWS resources.)

    • creationDate (datetime) --

      The date the state machine is created.

describe_state_machine_for_execution(**kwargs)

Describes the state machine associated with a specific execution.

See also: AWS API Documentation

Request Syntax

response = client.describe_state_machine_for_execution(
    executionArn='string'
)
Parameters
executionArn (string) --

[REQUIRED]

The Amazon Resource Name (ARN) of the execution you want state machine information for.

Return type
dict
Returns
Response Syntax
{
    'stateMachineArn': 'string',
    'name': 'string',
    'definition': 'string',
    'roleArn': 'string',
    'updateDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --
    • stateMachineArn (string) --

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

    • name (string) --

      The name of the state machine associated with the execution.

    • definition (string) --

      The Amazon States Language definition of the state machine.

    • roleArn (string) --

      The Amazon Resource Name (ARN) of the IAM role of the State Machine for the execution.

    • updateDate (datetime) --

      The date and time the state machine associated with an execution was updated. For a newly created state machine, this is the creation date.

generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_activity_task(**kwargs)

Used by workers to retrieve a task (with the specified activity ARN) which has been scheduled for execution by a running state machine. This initiates a long poll, where the service holds the HTTP connection open and responds as soon as a task becomes available (i.e. an execution of a task of this type is needed.) The maximum time the service holds on to the request before responding is 60 seconds. If no task is available within 60 seconds, the poll returns a taskToken with a null string.

Warning

Workers should set their client side socket timeout to at least 65 seconds (5 seconds higher than the maximum time the service may hold the poll request).

See also: AWS API Documentation

Request Syntax

response = client.get_activity_task(
    activityArn='string',
    workerName='string'
)
Parameters
  • activityArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the activity to retrieve tasks from (assigned when you create the task using CreateActivity .)

  • workerName (string) -- You can provide an arbitrary name in order to identify the worker that the task is assigned to. This name is used when it is logged in the execution history.
Return type

dict

Returns

Response Syntax

{
    'taskToken': 'string',
    'input': 'string'
}

Response Structure

  • (dict) --

    • taskToken (string) --

      A token that identifies the scheduled task. This token must be copied and included in subsequent calls to SendTaskHeartbeat , SendTaskSuccess or SendTaskFailure in order to report the progress or completion of the task.

    • input (string) --

      The string that contains the JSON input data for the task.

get_execution_history(**kwargs)

Returns the history of the specified execution as a list of events. By default, the results are returned in ascending order of the timeStamp of the events. Use the reverseOrder parameter to get the latest events first.

If a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

See also: AWS API Documentation

Request Syntax

response = client.get_execution_history(
    executionArn='string',
    maxResults=123,
    reverseOrder=True|False,
    nextToken='string'
)
Parameters
  • executionArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the execution.

  • 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 100. 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.

  • reverseOrder (boolean) -- Lists events in descending order of their timeStamp .
  • nextToken (string) --

    If a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

    The configured maxResults determines how many results can be returned in a single call.

Return type

dict

Returns

Response Syntax

{
    'events': [
        {
            'timestamp': datetime(2015, 1, 1),
            'type': 'ActivityFailed'|'ActivityScheduleFailed'|'ActivityScheduled'|'ActivityStarted'|'ActivitySucceeded'|'ActivityTimedOut'|'ChoiceStateEntered'|'ChoiceStateExited'|'ExecutionFailed'|'ExecutionStarted'|'ExecutionSucceeded'|'ExecutionAborted'|'ExecutionTimedOut'|'FailStateEntered'|'LambdaFunctionFailed'|'LambdaFunctionScheduleFailed'|'LambdaFunctionScheduled'|'LambdaFunctionStartFailed'|'LambdaFunctionStarted'|'LambdaFunctionSucceeded'|'LambdaFunctionTimedOut'|'SucceedStateEntered'|'SucceedStateExited'|'TaskStateAborted'|'TaskStateEntered'|'TaskStateExited'|'PassStateEntered'|'PassStateExited'|'ParallelStateAborted'|'ParallelStateEntered'|'ParallelStateExited'|'ParallelStateFailed'|'ParallelStateStarted'|'ParallelStateSucceeded'|'WaitStateAborted'|'WaitStateEntered'|'WaitStateExited',
            'id': 123,
            'previousEventId': 123,
            'activityFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'activityScheduleFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'activityScheduledEventDetails': {
                'resource': 'string',
                'input': 'string',
                'timeoutInSeconds': 123,
                'heartbeatInSeconds': 123
            },
            'activityStartedEventDetails': {
                'workerName': 'string'
            },
            'activitySucceededEventDetails': {
                'output': 'string'
            },
            'activityTimedOutEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'executionFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'executionStartedEventDetails': {
                'input': 'string',
                'roleArn': 'string'
            },
            'executionSucceededEventDetails': {
                'output': 'string'
            },
            'executionAbortedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'executionTimedOutEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'lambdaFunctionFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'lambdaFunctionScheduleFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'lambdaFunctionScheduledEventDetails': {
                'resource': 'string',
                'input': 'string',
                'timeoutInSeconds': 123
            },
            'lambdaFunctionStartFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'lambdaFunctionSucceededEventDetails': {
                'output': 'string'
            },
            'lambdaFunctionTimedOutEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'stateEnteredEventDetails': {
                'name': 'string',
                'input': 'string'
            },
            'stateExitedEventDetails': {
                'name': 'string',
                'output': 'string'
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • events (list) --

      The list of events that occurred in the execution.

      • (dict) --

        Contains details about the events of an execution.

        • timestamp (datetime) --

          The date the event occurred.

        • type (string) --

          The type of the event.

        • id (integer) --

          The id of the event. Events are numbered sequentially, starting at one.

        • previousEventId (integer) --

          The id of the previous event.

        • activityFailedEventDetails (dict) --

          Contains details about an activity which failed during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • activityScheduleFailedEventDetails (dict) --

          Contains details about an activity schedule event which failed during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • activityScheduledEventDetails (dict) --

          Contains details about an activity scheduled during an execution.

          • resource (string) --

            The Amazon Resource Name (ARN) of the scheduled activity.

          • input (string) --

            The JSON data input to the activity task.

          • timeoutInSeconds (integer) --

            The maximum allowed duration of the activity task.

          • heartbeatInSeconds (integer) --

            The maximum allowed duration between two heartbeats for the activity task.

        • activityStartedEventDetails (dict) --

          Contains details about the start of an activity during an execution.

          • workerName (string) --

            The name of the worker that the task is assigned to. These names are provided by the workers when calling GetActivityTask .

        • activitySucceededEventDetails (dict) --

          Contains details about an activity which successfully terminated during an execution.

          • output (string) --

            The JSON data output by the activity task.

        • activityTimedOutEventDetails (dict) --

          Contains details about an activity timeout which occurred during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the timeout.

        • executionFailedEventDetails (dict) --

          Contains details about an execution failure event.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • executionStartedEventDetails (dict) --

          Contains details about the start of the execution.

          • input (string) --

            The JSON data input to the execution.

          • roleArn (string) --

            The Amazon Resource Name (ARN) of the IAM role used for executing AWS Lambda tasks.

        • executionSucceededEventDetails (dict) --

          Contains details about the successful termination of the execution.

          • output (string) --

            The JSON data output by the execution.

        • executionAbortedEventDetails (dict) --

          Contains details about an abort of an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • executionTimedOutEventDetails (dict) --

          Contains details about the execution timeout which occurred during the execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the timeout.

        • lambdaFunctionFailedEventDetails (dict) --

          Contains details about a lambda function which failed during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • lambdaFunctionScheduleFailedEventDetails (dict) --

          Contains details about a failed lambda function schedule event which occurred during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • lambdaFunctionScheduledEventDetails (dict) --

          Contains details about a lambda function scheduled during an execution.

          • resource (string) --

            The Amazon Resource Name (ARN) of the scheduled lambda function.

          • input (string) --

            The JSON data input to the lambda function.

          • timeoutInSeconds (integer) --

            The maximum allowed duration of the lambda function.

        • lambdaFunctionStartFailedEventDetails (dict) --

          Contains details about a lambda function which failed to start during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • lambdaFunctionSucceededEventDetails (dict) --

          Contains details about a lambda function which terminated successfully during an execution.

          • output (string) --

            The JSON data output by the lambda function.

        • lambdaFunctionTimedOutEventDetails (dict) --

          Contains details about a lambda function timeout which occurred during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the timeout.

        • stateEnteredEventDetails (dict) --

          Contains details about a state entered during an execution.

          • name (string) --

            The name of the state.

          • input (string) --

            The string that contains the JSON input data for the state.

        • stateExitedEventDetails (dict) --

          Contains details about an exit from a state during an execution.

          • name (string) --

            The name of the state.

            A name must not contain:

            • whitespace
            • brackets `` { } [ ]``
            • wildcard characters ? *
            • special characters " # % \ ^ | ~ ` $ , ; : /
            • control characters (U+0000-001F , U+007F-009F )
          • output (string) --

            The JSON output data of the state.

    • nextToken (string) --

      If a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

      The configured maxResults determines how many results can be returned in a single call.

get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)
list_activities(**kwargs)

Lists the existing activities.

If a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

See also: AWS API Documentation

Request Syntax

response = client.list_activities(
    maxResults=123,
    nextToken='string'
)
Parameters
  • 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 100. 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 a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

    The configured maxResults determines how many results can be returned in a single call.

Return type

dict

Returns

Response Syntax

{
    'activities': [
        {
            'activityArn': 'string',
            'name': 'string',
            'creationDate': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • activities (list) --

      The list of activities.

      • (dict) --

        Contains details about an activity.

        • activityArn (string) --

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

        • name (string) --

          The name of the activity.

          A name must not contain:

          • whitespace
          • brackets `` { } [ ]``
          • wildcard characters ? *
          • special characters " # % \ ^ | ~ ` $ , ; : /
          • control characters (U+0000-001F , U+007F-009F )
        • creationDate (datetime) --

          The date the activity is created.

    • nextToken (string) --

      If a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

      The configured maxResults determines how many results can be returned in a single call.

list_executions(**kwargs)

Lists the executions of a state machine that meet the filtering criteria.

If a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

See also: AWS API Documentation

Request Syntax

response = client.list_executions(
    stateMachineArn='string',
    statusFilter='RUNNING'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'ABORTED',
    maxResults=123,
    nextToken='string'
)
Parameters
  • stateMachineArn (string) --

    [REQUIRED]

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

  • 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 100. 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 a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

    The configured maxResults determines how many results can be returned in a single call.

Return type

dict

Returns

Response Syntax

{
    'executions': [
        {
            'executionArn': 'string',
            'stateMachineArn': 'string',
            'name': 'string',
            'status': 'RUNNING'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'ABORTED',
            'startDate': datetime(2015, 1, 1),
            'stopDate': 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 executed state machine.

        • name (string) --

          The name of the execution.

          A name must not contain:

          • whitespace
          • brackets `` { } [ ]``
          • wildcard characters ? *
          • special characters " # % \ ^ | ~ ` $ , ; : /
          • control characters (U+0000-001F , U+007F-009F )
        • 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.

    • nextToken (string) --

      If a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

      The configured maxResults determines how many results can be returned in a single call.

list_state_machines(**kwargs)

Lists the existing state machines.

If a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

See also: AWS API Documentation

Request Syntax

response = client.list_state_machines(
    maxResults=123,
    nextToken='string'
)
Parameters
  • 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 100. 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 a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

    The configured maxResults determines how many results can be returned in a single call.

Return type

dict

Returns

Response Syntax

{
    'stateMachines': [
        {
            'stateMachineArn': 'string',
            'name': 'string',
            'creationDate': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • stateMachines (list) --

      • (dict) --

        Contains details about the state machine.

        • stateMachineArn (string) --

          The Amazon Resource Name (ARN) that identifies the state machine.

        • name (string) --

          The name of the state machine.

          A name must not contain:

          • whitespace
          • brackets `` { } [ ]``
          • wildcard characters ? *
          • special characters " # % \ ^ | ~ ` $ , ; : /
          • control characters (U+0000-001F , U+007F-009F )
        • creationDate (datetime) --

          The date the state machine is created.

    • nextToken (string) --

      If a nextToken is returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextToken . Keep all other arguments unchanged.

      The configured maxResults determines how many results can be returned in a single call.

send_task_failure(**kwargs)

Used by workers to report that the task identified by the taskToken failed.

See also: AWS API Documentation

Request Syntax

response = client.send_task_failure(
    taskToken='string',
    error='string',
    cause='string'
)
Parameters
  • taskToken (string) --

    [REQUIRED]

    The token that represents this task. Task tokens are generated by the service when the tasks are assigned to a worker (see GetActivityTask::taskToken).

  • error (string) -- An arbitrary error code that identifies the cause of the failure.
  • cause (string) -- A more detailed explanation of the cause of the failure.
Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

send_task_heartbeat(**kwargs)

Used by workers to report to the service that the task represented by the specified taskToken is still making progress. This action resets the Heartbeat clock. The Heartbeat threshold is specified in the state machine's Amazon States Language definition. This action does not in itself create an event in the execution history. However, if the task times out, the execution history contains an ActivityTimedOut event.

Note

The Timeout of a task, defined in the state machine's Amazon States Language definition, is its maximum allowed duration, regardless of the number of SendTaskHeartbeat requests received.

Note

This operation is only useful for long-lived tasks to report the liveliness of the task.

See also: AWS API Documentation

Request Syntax

response = client.send_task_heartbeat(
    taskToken='string'
)
Parameters
taskToken (string) --

[REQUIRED]

The token that represents this task. Task tokens are generated by the service when the tasks are assigned to a worker (see GetActivityTaskOutput$taskToken ).

Return type
dict
Returns
Response Syntax
{}

Response Structure

  • (dict) --
send_task_success(**kwargs)

Used by workers to report that the task identified by the taskToken completed successfully.

See also: AWS API Documentation

Request Syntax

response = client.send_task_success(
    taskToken='string',
    output='string'
)
Parameters
  • taskToken (string) --

    [REQUIRED]

    The token that represents this task. Task tokens are generated by the service when the tasks are assigned to a worker (see GetActivityTaskOutput$taskToken ).

  • output (string) --

    [REQUIRED]

    The JSON output of the task.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

start_execution(**kwargs)

Starts a state machine execution.

See also: AWS API Documentation

Request Syntax

response = client.start_execution(
    stateMachineArn='string',
    name='string',
    input='string'
)
Parameters
  • stateMachineArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the state machine to execute.

  • name (string) --

    The name of the execution. This name must be unique for your AWS account and region for 90 days. For more information, see Limits Related to State Machine Executions in the AWS Step Functions Developer Guide .

    Warning

    An execution can't use the name of another execution for 90 days.

    When you make multiple StartExecution calls with the same name, the new execution doesn't run and the following rules apply:

    • When the original execution is open and the execution input from the new call is different , the ExecutionAlreadyExists message is returned.
    • When the original execution is open and the execution input from the new call is identical , the Success message is returned.
    • When the original execution is closed, the ExecutionAlreadyExists message is returned regardless of input.

    A name must not contain:

    • whitespace
    • brackets `` { } [ ]``
    • wildcard characters ? *
    • special characters " # % \ ^ | ~ ` $ , ; : /
    • control characters (U+0000-001F , U+007F-009F )
  • input (string) --

    The string that contains the JSON input data for the execution, for example:

    "input": "{\"first_name\" : \"test\"}"

    Note

    If you don't include any JSON input data, you still must include the two braces, for example: "input": "{}"

Return type

dict

Returns

Response Syntax

{
    'executionArn': 'string',
    'startDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • executionArn (string) --

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

    • startDate (datetime) --

      The date the execution is started.

stop_execution(**kwargs)

Stops an execution.

See also: AWS API Documentation

Request Syntax

response = client.stop_execution(
    executionArn='string',
    error='string',
    cause='string'
)
Parameters
  • executionArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the execution to stop.

  • error (string) -- An arbitrary error code that identifies the cause of the termination.
  • cause (string) -- A more detailed explanation of the cause of the termination.
Return type

dict

Returns

Response Syntax

{
    'stopDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • stopDate (datetime) --

      The date the execution is stopped.

update_state_machine(**kwargs)

Updates an existing state machine by modifying its definition and/or roleArn . Running executions will continue to use the previous definition and roleArn .

Note

All StartExecution calls within a few seconds will use the updated definition and roleArn . Executions started immediately after calling UpdateStateMachine may use the previous state machine definition and roleArn . You must include at least one of definition or roleArn or you will receive a MissingRequiredParameter error.

See also: AWS API Documentation

Request Syntax

response = client.update_state_machine(
    stateMachineArn='string',
    definition='string',
    roleArn='string'
)
Parameters
  • stateMachineArn (string) --

    [REQUIRED]

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

  • definition (string) -- The Amazon States Language definition of the state machine.
  • roleArn (string) -- The Amazon Resource Name (ARN) of the IAM role of the state machine.
Return type

dict

Returns

Response Syntax

{
    'updateDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • updateDate (datetime) --

      The date and time the state machine was updated.

Paginators

The available paginators are:

class SFN.Paginator.GetExecutionHistory
paginator = client.get_paginator('get_execution_history')
paginate(**kwargs)

Creates an iterator that will paginate through responses from SFN.Client.get_execution_history().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    executionArn='string',
    reverseOrder=True|False,
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • executionArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the execution.

  • reverseOrder (boolean) -- Lists events in descending order of their timeStamp .
  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'events': [
        {
            'timestamp': datetime(2015, 1, 1),
            'type': 'ActivityFailed'|'ActivityScheduleFailed'|'ActivityScheduled'|'ActivityStarted'|'ActivitySucceeded'|'ActivityTimedOut'|'ChoiceStateEntered'|'ChoiceStateExited'|'ExecutionFailed'|'ExecutionStarted'|'ExecutionSucceeded'|'ExecutionAborted'|'ExecutionTimedOut'|'FailStateEntered'|'LambdaFunctionFailed'|'LambdaFunctionScheduleFailed'|'LambdaFunctionScheduled'|'LambdaFunctionStartFailed'|'LambdaFunctionStarted'|'LambdaFunctionSucceeded'|'LambdaFunctionTimedOut'|'SucceedStateEntered'|'SucceedStateExited'|'TaskStateAborted'|'TaskStateEntered'|'TaskStateExited'|'PassStateEntered'|'PassStateExited'|'ParallelStateAborted'|'ParallelStateEntered'|'ParallelStateExited'|'ParallelStateFailed'|'ParallelStateStarted'|'ParallelStateSucceeded'|'WaitStateAborted'|'WaitStateEntered'|'WaitStateExited',
            'id': 123,
            'previousEventId': 123,
            'activityFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'activityScheduleFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'activityScheduledEventDetails': {
                'resource': 'string',
                'input': 'string',
                'timeoutInSeconds': 123,
                'heartbeatInSeconds': 123
            },
            'activityStartedEventDetails': {
                'workerName': 'string'
            },
            'activitySucceededEventDetails': {
                'output': 'string'
            },
            'activityTimedOutEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'executionFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'executionStartedEventDetails': {
                'input': 'string',
                'roleArn': 'string'
            },
            'executionSucceededEventDetails': {
                'output': 'string'
            },
            'executionAbortedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'executionTimedOutEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'lambdaFunctionFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'lambdaFunctionScheduleFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'lambdaFunctionScheduledEventDetails': {
                'resource': 'string',
                'input': 'string',
                'timeoutInSeconds': 123
            },
            'lambdaFunctionStartFailedEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'lambdaFunctionSucceededEventDetails': {
                'output': 'string'
            },
            'lambdaFunctionTimedOutEventDetails': {
                'error': 'string',
                'cause': 'string'
            },
            'stateEnteredEventDetails': {
                'name': 'string',
                'input': 'string'
            },
            'stateExitedEventDetails': {
                'name': 'string',
                'output': 'string'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • events (list) --

      The list of events that occurred in the execution.

      • (dict) --

        Contains details about the events of an execution.

        • timestamp (datetime) --

          The date the event occurred.

        • type (string) --

          The type of the event.

        • id (integer) --

          The id of the event. Events are numbered sequentially, starting at one.

        • previousEventId (integer) --

          The id of the previous event.

        • activityFailedEventDetails (dict) --

          Contains details about an activity which failed during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • activityScheduleFailedEventDetails (dict) --

          Contains details about an activity schedule event which failed during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • activityScheduledEventDetails (dict) --

          Contains details about an activity scheduled during an execution.

          • resource (string) --

            The Amazon Resource Name (ARN) of the scheduled activity.

          • input (string) --

            The JSON data input to the activity task.

          • timeoutInSeconds (integer) --

            The maximum allowed duration of the activity task.

          • heartbeatInSeconds (integer) --

            The maximum allowed duration between two heartbeats for the activity task.

        • activityStartedEventDetails (dict) --

          Contains details about the start of an activity during an execution.

          • workerName (string) --

            The name of the worker that the task is assigned to. These names are provided by the workers when calling GetActivityTask .

        • activitySucceededEventDetails (dict) --

          Contains details about an activity which successfully terminated during an execution.

          • output (string) --

            The JSON data output by the activity task.

        • activityTimedOutEventDetails (dict) --

          Contains details about an activity timeout which occurred during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the timeout.

        • executionFailedEventDetails (dict) --

          Contains details about an execution failure event.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • executionStartedEventDetails (dict) --

          Contains details about the start of the execution.

          • input (string) --

            The JSON data input to the execution.

          • roleArn (string) --

            The Amazon Resource Name (ARN) of the IAM role used for executing AWS Lambda tasks.

        • executionSucceededEventDetails (dict) --

          Contains details about the successful termination of the execution.

          • output (string) --

            The JSON data output by the execution.

        • executionAbortedEventDetails (dict) --

          Contains details about an abort of an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • executionTimedOutEventDetails (dict) --

          Contains details about the execution timeout which occurred during the execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the timeout.

        • lambdaFunctionFailedEventDetails (dict) --

          Contains details about a lambda function which failed during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • lambdaFunctionScheduleFailedEventDetails (dict) --

          Contains details about a failed lambda function schedule event which occurred during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • lambdaFunctionScheduledEventDetails (dict) --

          Contains details about a lambda function scheduled during an execution.

          • resource (string) --

            The Amazon Resource Name (ARN) of the scheduled lambda function.

          • input (string) --

            The JSON data input to the lambda function.

          • timeoutInSeconds (integer) --

            The maximum allowed duration of the lambda function.

        • lambdaFunctionStartFailedEventDetails (dict) --

          Contains details about a lambda function which failed to start during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the failure.

        • lambdaFunctionSucceededEventDetails (dict) --

          Contains details about a lambda function which terminated successfully during an execution.

          • output (string) --

            The JSON data output by the lambda function.

        • lambdaFunctionTimedOutEventDetails (dict) --

          Contains details about a lambda function timeout which occurred during an execution.

          • error (string) --

            The error code of the failure.

          • cause (string) --

            A more detailed explanation of the cause of the timeout.

        • stateEnteredEventDetails (dict) --

          Contains details about a state entered during an execution.

          • name (string) --

            The name of the state.

          • input (string) --

            The string that contains the JSON input data for the state.

        • stateExitedEventDetails (dict) --

          Contains details about an exit from a state during an execution.

          • name (string) --

            The name of the state.

            A name must not contain:

            • whitespace
            • brackets `` { } [ ]``
            • wildcard characters ? *
            • special characters " # % \ ^ | ~ ` $ , ; : /
            • control characters (U+0000-001F , U+007F-009F )
          • output (string) --

            The JSON output data of the state.

    • NextToken (string) --

      A token to resume pagination.

class SFN.Paginator.ListActivities
paginator = client.get_paginator('list_activities')
paginate(**kwargs)

Creates an iterator that will paginate through responses from SFN.Client.list_activities().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
PaginationConfig (dict) --

A dictionary that provides parameters to control pagination.

  • MaxItems (integer) --

    The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

  • PageSize (integer) --

    The size of each page.

  • StartingToken (string) --

    A token to specify where to start paginating. This is the NextToken from a previous response.

Return type
dict
Returns
Response Syntax
{
    'activities': [
        {
            'activityArn': 'string',
            'name': 'string',
            'creationDate': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --
    • activities (list) --

      The list of activities.

      • (dict) --

        Contains details about an activity.

        • activityArn (string) --

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

        • name (string) --

          The name of the activity.

          A name must not contain:

          • whitespace
          • brackets `` { } [ ]``
          • wildcard characters ? *
          • special characters " # % \ ^ | ~ ` $ , ; : /
          • control characters (U+0000-001F , U+007F-009F )
        • creationDate (datetime) --

          The date the activity is created.

    • NextToken (string) --

      A token to resume pagination.

class SFN.Paginator.ListExecutions
paginator = client.get_paginator('list_executions')
paginate(**kwargs)

Creates an iterator that will paginate through responses from SFN.Client.list_executions().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    stateMachineArn='string',
    statusFilter='RUNNING'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'ABORTED',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • stateMachineArn (string) --

    [REQUIRED]

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

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

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'executions': [
        {
            'executionArn': 'string',
            'stateMachineArn': 'string',
            'name': 'string',
            'status': 'RUNNING'|'SUCCEEDED'|'FAILED'|'TIMED_OUT'|'ABORTED',
            'startDate': datetime(2015, 1, 1),
            'stopDate': 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 executed state machine.

        • name (string) --

          The name of the execution.

          A name must not contain:

          • whitespace
          • brackets `` { } [ ]``
          • wildcard characters ? *
          • special characters " # % \ ^ | ~ ` $ , ; : /
          • control characters (U+0000-001F , U+007F-009F )
        • 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.

    • NextToken (string) --

      A token to resume pagination.

class SFN.Paginator.ListStateMachines
paginator = client.get_paginator('list_state_machines')
paginate(**kwargs)

Creates an iterator that will paginate through responses from SFN.Client.list_state_machines().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
PaginationConfig (dict) --

A dictionary that provides parameters to control pagination.

  • MaxItems (integer) --

    The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

  • PageSize (integer) --

    The size of each page.

  • StartingToken (string) --

    A token to specify where to start paginating. This is the NextToken from a previous response.

Return type
dict
Returns
Response Syntax
{
    'stateMachines': [
        {
            'stateMachineArn': 'string',
            'name': 'string',
            'creationDate': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --
    • stateMachines (list) --
      • (dict) --

        Contains details about the state machine.

        • stateMachineArn (string) --

          The Amazon Resource Name (ARN) that identifies the state machine.

        • name (string) --

          The name of the state machine.

          A name must not contain:

          • whitespace
          • brackets `` { } [ ]``
          • wildcard characters ? *
          • special characters " # % \ ^ | ~ ` $ , ; : /
          • control characters (U+0000-001F , U+007F-009F )
        • creationDate (datetime) --

          The date the state machine is created.

    • NextToken (string) --

      A token to resume pagination.