Executions

SWF workflow execution management.

ChildExecutionTerminationPolicy

Child workflow execution ending policy on parent termination.

CloseStatusExecutionFilter

Workflow execution filter on execution close-status.

CloseTimeExecutionFilter

Workflow execution filter on close-time.

CurrentExecutionId

Current open workflow execution specifier.

ExecutionConfiguration

Workflow execution configuration.

ExecutionDetails

Workflow execution details, configuration, open-counts and snapshot.

ExecutionFilter

Workflow execution filter.

ExecutionId

Workflow execution identifier.

ExecutionInfo

Workflow execution details.

ExecutionOpenCounts

Counts of workflow executions' open tasks/timers/children.

ExecutionStatus

Workflow execution status.

IdExecutionFilter

Workflow execution filter on execution workflow-ID.

PartialExecutionConfiguration

Partial workflow execution configuration.

StartTimeExecutionFilter

Workflow execution filter on start-time.

TagExecutionFilter

Workflow execution filter on execution tags.

WorkflowTypeExecutionFilter

Workflow execution filter on execution workflow-type.

describe_execution

Describe a workflow execution.

get_number_of_closed_executions

Get the number of closed workflow executions.

get_number_of_open_executions

Get the number of open workflow executions.

list_closed_executions

List closed workflow executions; retrieved semi-lazily.

list_open_executions

List open workflow executions; retrieved semi-lazily.

request_cancel_execution

Request the cancellation of a workflow execution.

signal_execution

Send a signal to a workflow execution.

start_execution

Start a workflow execution.

terminate_execution

Terminate (immediately close) a workflow execution.

class swf_typed.ChildExecutionTerminationPolicy(*values)[source]

Child workflow execution ending policy on parent termination.

abandon = 'ABANDON'

Abandon child executions.

request_cancel = 'REQUEST_CANCEL'

Request for child execution cancellation.

terminate = 'TERMINATE'

Terminate child executions.

class swf_typed.CloseStatusExecutionFilter(status: str)[source]

Workflow execution filter on execution close-status.

get_api_args()[source]

Serialise to SWF API request arguments.

status: str

Execution status.

class swf_typed.CloseTimeExecutionFilter(earliest: datetime, latest: datetime = None)[source]

Workflow execution filter on close-time.

earliest: datetime

Earliest date.

get_api_args()[source]

Serialise to SWF API request arguments.

latest: datetime = None

Latest date.

to_api()

Serialise to SWF API request data.

class swf_typed.CurrentExecutionId(id: str)[source]

Current open workflow execution specifier.

classmethod from_api(data) CurrentExecutionId[source]

Deserialise from SWF API response data.

id: str

Execution workflow-ID.

to_api()[source]

Serialise to SWF API request data.

class swf_typed.ExecutionConfiguration(timeout: timedelta | None, decision_task_timeout: timedelta | None, decision_task_list: str, child_execution_policy_on_termination: ChildExecutionTerminationPolicy, decision_task_priority: int = None, lambda_iam_role_arn: str = None)[source]

Workflow execution configuration.

child_execution_policy_on_termination: ChildExecutionTerminationPolicy

Child workflow execution ending policy on termination.

decision_task_list: str

Decision task task-list.

decision_task_priority: int = None

Decision task priority.

decision_task_timeout: timedelta | None

Decision task timeout.

classmethod from_api(data) ExecutionConfiguration[source]

Deserialise from SWF API response data.

lambda_iam_role_arn: str = None

Execution IAM role ARN for Lambda invocations.

timeout: timedelta | None

Execution run-time timeout.

class swf_typed.ExecutionDetails(info: ExecutionInfo, configuration: ExecutionConfiguration = None, n_open: ExecutionOpenCounts = None, latest_activity_task_scheduled: datetime = None, latest_context: str = None)[source]

Workflow execution details, configuration, open-counts and snapshot.

configuration: ExecutionConfiguration = None

Execution configuration.

classmethod from_api(data) ExecutionDetails[source]
info: ExecutionInfo

Execution details.

latest_activity_task_scheduled: datetime = None

Most recent activity task’s scheduled’s date.

latest_context: str = None

Most recent decision’s execution context.

n_open: ExecutionOpenCounts = None

Counts of open tasks/timers/children in execution.

class swf_typed.ExecutionFilter[source]

Workflow execution filter.

abstract get_api_args()[source]

Serialise to SWF API request arguments.

class swf_typed.ExecutionId(id: str, run_id: str)[source]

Workflow execution identifier.

classmethod from_api(data) ExecutionId[source]

Deserialise from SWF API response data.

id: str

Execution workflow-ID.

run_id: str

Execution run-ID.

to_api()[source]

Serialise to SWF API request data.

class swf_typed.ExecutionInfo(execution: ExecutionId, workflow: _workflows.WorkflowId, started: datetime, status: ExecutionStatus, cancel_requested: bool, closed: datetime = None, parent: ExecutionId = None, tags: List[str] = None)[source]

Workflow execution details.

cancel_requested: bool

Execution cancellation has been requested.

closed: datetime = None

Execution end-date.

execution: ExecutionId

Execution ID.

classmethod from_api(data) ExecutionInfo[source]

Deserialise from SWF API response data.

parent: ExecutionId = None

Parent execution ID.

started: datetime

Execution start-date.

status: ExecutionStatus

Execution status.

tags: List[str] = None

Execution tags.

workflow: _workflows.WorkflowId

Execution workflow.

class swf_typed.ExecutionOpenCounts(activity_tasks: int, decision_tasks: int, timers: int, child_executions: int, lambda_tasks: int = None)[source]

Counts of workflow executions’ open tasks/timers/children.

activity_tasks: int

Number of scheduled/started activity tasks.

child_executions: int

Number of started child executions.

decision_tasks: int

Number of scheduled/started decision tasks.

classmethod from_api(data) ExecutionOpenCounts[source]
lambda_tasks: int = None

Number of scheduled/started Lambda invocations.

timers: int

Number of started timers.

class swf_typed.ExecutionStatus(*values)[source]

Workflow execution status.

cancelled = 'CANCELED'

Execution has been cancelled.

completed = 'COMPLETED'

Execution has finished successfully.

continued_as_new = 'CONTINUED_AS_NEW'

Execution has been continued as a new execution.

failed = 'FAILED'

Execution has failed.

open = 'OPEN'

Execution is in-progress.

started = 'OPEN'

Execution is in-progress.

terminated = 'TERMINATED'

Execution has been terminated.

timed_out = 'TIMED_OUT'

Execution has timed out.

class swf_typed.IdExecutionFilter(execution: CurrentExecutionId)[source]

Workflow execution filter on execution workflow-ID.

execution: CurrentExecutionId

Execution ID.

get_api_args()[source]

Serialise to SWF API request arguments.

class swf_typed.PartialExecutionConfiguration(timeout: timedelta | None = _Sentinel(), decision_task_timeout: timedelta | None = _Sentinel(), decision_task_list: str = None, child_execution_policy_on_termination: ChildExecutionTerminationPolicy = None, decision_task_priority: int = None, lambda_iam_role_arn: str = None)[source]

Partial workflow execution configuration.

child_execution_policy_on_termination: ChildExecutionTerminationPolicy = None

Child workflow execution ending policy on termination.

decision_task_list: str = None

Decision task task-list.

decision_task_priority: int = None

Decision task priority.

decision_task_timeout: timedelta | None = _Sentinel()

Decision task timeout.

classmethod from_api(data) PartialExecutionConfiguration[source]

Deserialise from SWF API response data.

get_api_args()[source]

Serialise to SWF API request arguments.

lambda_iam_role_arn: str = None

Execution IAM role ARN for Lambda invocations.

timeout: timedelta | None = _Sentinel()

Execution run-time timeout.

class swf_typed.StartTimeExecutionFilter(earliest: datetime, latest: datetime = None)[source]

Workflow execution filter on start-time.

earliest: datetime

Earliest date.

get_api_args()[source]

Serialise to SWF API request arguments.

latest: datetime = None

Latest date.

to_api()

Serialise to SWF API request data.

class swf_typed.TagExecutionFilter(tag: str)[source]

Workflow execution filter on execution tags.

get_api_args()[source]

Serialise to SWF API request arguments.

tag: str

Execution tag.

class swf_typed.WorkflowTypeExecutionFilter(workflow: ForwardRef('_workflows.WorkflowId') | ForwardRef('_workflows.WorkflowIdFilter'))[source]

Workflow execution filter on execution workflow-type.

get_api_args()[source]

Serialise to SWF API request arguments.

workflow: ForwardRef('_workflows.WorkflowId') | ForwardRef('_workflows.WorkflowIdFilter')

Execution workflow.

swf_typed.describe_execution(execution: ExecutionId, domain: str, client: botocore.client.BaseClient = None) ExecutionDetails[source]

Describe a workflow execution.

Parameters:
  • execution – workflow execution to describe

  • domain – domain of workflow execution

  • client – SWF client

Returns:

workflow execution details, configuration, open-counts and snapshot

swf_typed.get_number_of_closed_executions(domain: str, time_filter: StartTimeExecutionFilter | CloseTimeExecutionFilter = None, property_filter: IdExecutionFilter | WorkflowTypeExecutionFilter | TagExecutionFilter | CloseStatusExecutionFilter = None, client: botocore.client.BaseClient = None) int[source]

Get the number of closed workflow executions.

Warns if the number of matching executions is greater than what’s returned.

Parameters:
  • domain – domain of executions

  • time_filter – execution start-time/close-time filter, default: executions closed less than 90 days ago

  • property_filter – execution workflow-ID/workflow-type/tags/close-status filter

  • client – SWF client

Returns:

number of matching workflow executions

swf_typed.get_number_of_open_executions(domain: str, started_filter: StartTimeExecutionFilter = None, property_filter: IdExecutionFilter | WorkflowTypeExecutionFilter | TagExecutionFilter = None, client: botocore.client.BaseClient = None) int[source]

Get the number of open workflow executions.

Warns if the number of matching executions is greater than what’s returned.

Parameters:
  • domain – domain of executions

  • started_filter – execution start-time filter, default: executions opened less than 90 days ago

  • property_filter – execution workflow-ID/workflow-type/tags filter

  • client – SWF client

Returns:

number of matching workflow executions

swf_typed.list_closed_executions(domain: str, time_filter: StartTimeExecutionFilter | CloseTimeExecutionFilter = None, property_filter: IdExecutionFilter | WorkflowTypeExecutionFilter | TagExecutionFilter | CloseStatusExecutionFilter = None, reverse: bool = False, client: botocore.client.BaseClient = None) Generator[ExecutionInfo, None, None][source]

List closed workflow executions; retrieved semi-lazily.

Parameters:
  • domain – domain of executions

  • time_filter – execution start-time/close-time filter, default: executions closed less than 90 days ago

  • property_filter – execution workflow-ID/workflow-type/tags/close-status filter

  • reverse – return results in reverse start/close order

  • client – SWF client

Returns:

matching workflow executions

swf_typed.list_open_executions(domain: str, started_filter: StartTimeExecutionFilter = None, property_filter: IdExecutionFilter | WorkflowTypeExecutionFilter | TagExecutionFilter = None, reverse: bool = False, client: botocore.client.BaseClient = None) Generator[ExecutionInfo, None, None][source]

List open workflow executions; retrieved semi-lazily.

Parameters:
  • domain – domain of executions

  • started_filter – execution start-time filter, default: executions opened less than 90 days ago

  • property_filter – execution workflow-ID/workflow-type/tags filter

  • reverse – return results in reverse start order

  • client – SWF client

Returns:

matching workflow executions

swf_typed.request_cancel_execution(execution: CurrentExecutionId | ExecutionId, domain: str, client: botocore.client.BaseClient = None) None[source]

Request the cancellation of a workflow execution.

Parameters:
  • execution – execution to cancel

  • domain – domain of execution

  • client – SWF client

swf_typed.signal_execution(execution: CurrentExecutionId | ExecutionId, signal: str, domain: str, input_: str = None, client: botocore.client.BaseClient = None) None[source]

Send a signal to a workflow execution.

Parameters:
  • execution – execution to signal

  • signal – signal name

  • domain – domain of execution

  • input – attached signal data

  • client – SWF client

swf_typed.start_execution(workflow: _workflows.WorkflowId, execution: CurrentExecutionId, domain: str, input: str = None, configuration: PartialExecutionConfiguration = None, tags: List[str] = None, client: botocore.client.BaseClient = None) ExecutionId[source]

Start a workflow execution.

Parameters:
  • workflow – workflow type for execution

  • execution – execution workflow-ID

  • domain – domain for execution

  • input – execution input

  • configuration – execution configuration, default: use defaults for workflow type

  • tags – execution tags

  • client – SWF client

Returns:

workflow execution, with run-ID

swf_typed.terminate_execution(execution: CurrentExecutionId | ExecutionId, domain: str, reason: str = None, details: str = None, child_execution_policy: ChildExecutionTerminationPolicy = None, client: botocore.client.BaseClient = None) None[source]

Terminate (immediately close) a workflow execution.

Parameters:
  • execution – workflow execution to close

  • domain – domain od execution

  • reason – termination reason, usually for classification

  • details – termination details, usually for explanation

  • child_execution_policy – how to handle open child workflow executions, default: use default for workflow type

  • client – SWF client