Table of Contents
SFN.Client¶A low-level client representing AWS Step Functions (SFN):
client = session.create_client('stepfunctions')
These are the available methods:
can_paginate()create_activity()create_state_machine()delete_activity()delete_state_machine()describe_activity()describe_execution()describe_state_machine()generate_presigned_url()get_activity_task()get_execution_history()get_paginator()get_waiter()list_activities()list_executions()list_state_machines()send_task_failure()send_task_heartbeat()send_task_success()start_execution()stop_execution()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.
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. |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'activityArn': 'string',
'creationDate': datetime(2015, 1, 1)
}
Response Structure
|
create_state_machine(**kwargs)¶Creates a state machine.
See also: AWS API Documentation
Request Syntax
response = client.create_state_machine(
name='string',
definition='string',
roleArn='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'stateMachineArn': 'string',
'creationDate': datetime(2015, 1, 1)
}
Response Structure
|
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
|
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 delete process.
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
|
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
|
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
|
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
|
generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)¶Generate a presigned url given a client, its method, and arguments
| Parameters: |
|
|---|---|
| Returns: | The presigned url |
get_activity_task(**kwargs)¶Used by workers to retrieve a task (with the specified activity ARN) 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 will return an empty result, that is, the taskToken returned is an empty 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: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'taskToken': 'string',
'input': 'string'
}
Response Structure
|
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. The results may be split into multiple pages. To retrieve subsequent pages, make the call again using the nextToken returned by the previous call.
See also: AWS API Documentation
Request Syntax
response = client.get_execution_history(
executionArn='string',
maxResults=123,
reverseOrder=True|False,
nextToken='string'
)
| Parameters: |
|
|---|---|
| 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'|'TaskStateEntered'|'TaskStateExited'|'PassStateEntered'|'PassStateExited'|'ParallelStateEntered'|'ParallelStateExited'|'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
|
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. The results may be split into multiple pages. To retrieve subsequent pages, make the call again using the nextToken returned by the previous call.
See also: AWS API Documentation
Request Syntax
response = client.list_activities(
maxResults=123,
nextToken='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'activities': [
{
'activityArn': 'string',
'name': 'string',
'creationDate': datetime(2015, 1, 1)
},
],
'nextToken': 'string'
}
Response Structure
|
list_executions(**kwargs)¶Lists the executions of a state machine that meet the filtering criteria. The results may be split into multiple pages. To retrieve subsequent pages, make the call again using the nextToken returned by the previous call.
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: |
|
|---|---|
| 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
|
list_state_machines(**kwargs)¶Lists the existing state machines. The results may be split into multiple pages. To retrieve subsequent pages, make the call again using the nextToken returned by the previous call.
See also: AWS API Documentation
Request Syntax
response = client.list_state_machines(
maxResults=123,
nextToken='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'stateMachines': [
{
'stateMachineArn': 'string',
'name': 'string',
'creationDate': datetime(2015, 1, 1)
},
],
'nextToken': 'string'
}
Response Structure
|
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: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {}
Response Structure
|
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 will contain 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 GetActivityTask::taskToken). |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{}
Response Structure
|
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: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {}
Response Structure
|
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: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'executionArn': 'string',
'startDate': datetime(2015, 1, 1)
}
Response Structure
|
stop_execution(**kwargs)¶Stops an execution.
See also: AWS API Documentation
Request Syntax
response = client.stop_execution(
executionArn='string',
error='string',
cause='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'stopDate': datetime(2015, 1, 1)
}
Response Structure
|
The available paginators are:
SFN.Paginator.GetExecutionHistorySFN.Paginator.ListActivitiesSFN.Paginator.ListExecutionsSFN.Paginator.ListStateMachinesSFN.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: |
|
|---|---|
| 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'|'TaskStateEntered'|'TaskStateExited'|'PassStateEntered'|'PassStateExited'|'ParallelStateEntered'|'ParallelStateExited'|'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
|
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.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'activities': [
{
'activityArn': 'string',
'name': 'string',
'creationDate': datetime(2015, 1, 1)
},
],
'NextToken': 'string'
}
Response Structure
|
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: |
|
|---|---|
| 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
|
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.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'stateMachines': [
{
'stateMachineArn': 'string',
'name': 'string',
'creationDate': datetime(2015, 1, 1)
},
],
'NextToken': 'string'
}
Response Structure
|