state¶
- class aws_stepfunction.state.State(id: str = _Nothing.NOTHING, type: str = 'UnknownState', comment: Optional[str] = None)[source]¶
Represent a step / a state in a workflow.
- Parameters
_uuid – for internal implementation. we track the associated state machine of each state object.
Serialization Field Order:
先展示信息量最大的, 例如 Type, Comment
- 再展示跟当前 State 的逻辑紧密相关的, 例如 Task 就需要关注 Resource,
Parallel 就需要关注 Branches, Map 就需要关注 Iterator 等等
接下来展示跟流程相关的 Next, End
最后展示详细的 Input Output 处理的细节
- class aws_stepfunction.state.Retry(error_equals: List[str] = _Nothing.NOTHING, interval_seconds: Optional[int] = None, backoff_rate: Optional[Union[float, int]] = None, max_attempts: Optional[int] = None)[source]¶
Reference:
- class aws_stepfunction.state.Catch(error_equals: List[str] = _Nothing.NOTHING, next: Optional[str] = None, result_path: Optional[str] = None)[source]¶
Reference:
- class aws_stepfunction.state.Task(comment: Optional[str] = None, next: Optional[str] = None, end: Optional[bool] = None, input_path: Optional[str] = None, output_path: Optional[str] = None, parameters: Dict[str, Any] = _Nothing.NOTHING, result_selector: Dict[str, Any] = _Nothing.NOTHING, result_path: Optional[str] = None, retry: List[aws_stepfunction.state.Retry] = _Nothing.NOTHING, catch: List[aws_stepfunction.state.Catch] = _Nothing.NOTHING, id: str = _Nothing.NOTHING, type: str = 'Task', resource: Optional[str] = None, timeout_seconds: Optional[int] = None, timeout_seconds_path: Optional[str] = None, heartbeat_seconds: Optional[int] = None, heartbeat_seconds_path: Optional[str] = None)[source]¶
A Task state
("Type": "Task")
represents a single unit of work performed by a state machine.All work in your state machine is done by tasks. A task performs work by using an activity or an AWS Lambda function, or by passing parameters to the API actions of other services.
- Parameters
resource – A URI, especially an ARN that uniquely identifies the specific task to execute.
timeout_seconds – If the task runs longer than the specified seconds, this state fails with a States.Timeout error name. Must be a positive, non-zero integer. If not provided, the default value is 99999999. The count begins after the task has been started, for example, when
ActivityStarted
orLambdaFunctionStarted
are logged in the Execution event history.timeout_seconds_path – If you want to provide a timeout value dynamically from the state input using a reference path, use
TimeoutSecondsPath
. When resolved, the reference path must select fields whose values are positive integers.heartbeat_seconds – If more time than the specified seconds elapses between heartbeats from the task, this state fails with a States. Timeout error name. Must be a positive, non-zero integer less than the number of seconds specified in the
TimeoutSeconds
field. If not provided, the default value is 99999999. For Activities, the count begins whenGetActivityTask
receives a token andActivityStarted
is logged in the Execution event history.heartbeat_seconds_path – If you want to provide a heartbeat value dynamically from the state input using a reference path, use
HeartbeatSecondsPath
. When resolved, the reference path must select fields whose values are positive integers.
Reference:
- class aws_stepfunction.state.Parallel(comment: Optional[str] = None, next: Optional[str] = None, end: Optional[bool] = None, input_path: Optional[str] = None, output_path: Optional[str] = None, parameters: Dict[str, Any] = _Nothing.NOTHING, result_selector: Dict[str, Any] = _Nothing.NOTHING, result_path: Optional[str] = None, retry: List[Retry] = _Nothing.NOTHING, catch: List[Catch] = _Nothing.NOTHING, id: str = _Nothing.NOTHING, type: str = 'Parallel', branches: List[Workflow] = _Nothing.NOTHING)[source]¶
The Parallel state
("Type": "Parallel")
can be used to create parallel branches of execution in your state machine.In addition to the common state fields, Parallel states include these additional fields.
- Parameters
branches – An array of objects that specify state machines to execute in parallel. Each such state machine object must have fields named States and StartAt, whose meanings are exactly like those in the top level of a state machine.
Reference:
- class aws_stepfunction.state.Map(comment: Optional[str] = None, next: Optional[str] = None, end: Optional[bool] = None, input_path: Optional[str] = None, output_path: Optional[str] = None, parameters: Dict[str, Any] = _Nothing.NOTHING, result_selector: Dict[str, Any] = _Nothing.NOTHING, result_path: Optional[str] = None, retry: List[Retry] = _Nothing.NOTHING, catch: List[Catch] = _Nothing.NOTHING, id: str = _Nothing.NOTHING, type: str = 'Map', iterator: Optional[Workflow] = None, items_path: Optional[str] = None, max_concurrency: Optional[int] = None)[source]¶
The Map state
("Type": "Map")
can be used to run a set of steps for each element of an input array. While the Parallel state executes multiple branches of steps using the same input, a Map state will execute the same steps for multiple entries of an array in the state input.- Parameters
iterator – The Iterator field’s value is an object that defines a state machine which will process each element of the array.
items_path – The ItemsPath field’s value is a reference path identifying where in the effective input the array field is found. For more information, see ItemsPath. States within an Iterator field can only transition to each other, and no state outside the Iterator field can transition to a state within it. If any iteration fails, entire Map state fails, and all iterations are terminated.
max_concurrency – The MaxConcurrencyfield’s value is an integer that provides an upper bound on how many invocations of the Iterator may run in parallel. For instance, a MaxConcurrency value of 10 will limit your Map state to 10 concurrent iterations running at one time.
Reference:
- class aws_stepfunction.state.Pass(comment: Optional[str] = None, input_path: Optional[str] = None, output_path: Optional[str] = None, next: Optional[str] = None, end: Optional[bool] = None, result_path: Optional[str] = None, parameters: Dict[str, Any] = _Nothing.NOTHING, id: str = _Nothing.NOTHING, type: str = 'Pass', result: Optional[dict] = None)[source]¶
A Pass state
("Type": "Pass")
passes its input to its output, without performing work. Pass states are useful when constructing and debugging state machines.In addition to the common state fields, Pass states allow the following fields.
- Parameters
result – refers to the output of a virtual task that is passed on to the next state. If you include the ‘ResultPath’ field in your state machine definition, ‘Result’ is placed as specified by ‘ResultPath’ and passed on to the next state.
Reference:
- class aws_stepfunction.state.Wait(comment: Optional[str] = None, input_path: Optional[str] = None, output_path: Optional[str] = None, next: Optional[str] = None, end: Optional[bool] = None, id: str = _Nothing.NOTHING, type: str = 'Wait', seconds: Optional[int] = None, timestamp: Optional[str] = None, seconds_path: Optional[str] = None, timestamp_path: Optional[str] = None)[source]¶
A Wait state
("Type": "Wait")
delays the state machine from continuing for a specified time. You can choose either a relative time, specified in seconds from when the state begins, or an absolute end time, specified as a timestamp.In addition to the common state fields, Wait states have one of the following fields.
- Parameters
seconds – A time, in seconds, to wait before beginning the state specified in the Next field. You must specify time as a positive, integer value.
timestamp – An absolute time to wait until beginning the state specified in the Next field. Timestamps must conform to the RFC3339 profile of ISO 8601, with the further restrictions that an uppercase T must separate the date and time portions, and an uppercase Z must denote that a numeric time zone offset is not present, for example,
2016-08-18T17:33:00Z
.seconds_path – A time, in seconds, to wait before beginning the state specified in the Next field, specified using a path from the state’s input data. You must specify an integer value for this field.
timestamp_path – An absolute time to wait until beginning the state specified in the Next field, specified using a path from the state’s input data.
Note
You must specify exactly one of
Seconds
,Timestamp
,SecondsPath
orTimestampPath
. In addition, the maximum wait time that you can specify for Standard Workflows and Express workflows is one year and five minutes respectively.Reference:
- class aws_stepfunction.state.Choice(comment: Optional[str] = None, input_path: Optional[str] = None, output_path: Optional[str] = None, id: str = _Nothing.NOTHING, type: str = 'Choice', choices: List[aws_stepfunction.choice_rule.ChoiceRule] = _Nothing.NOTHING, default: Optional[str] = None)[source]¶
A Choice state
("Type": "Choice")
adds branching logic to a state machine.In addition to most of the common state fields, Choice states introduce the following additional fields.
- Parameters
choices – An array of Choice Rules that determines which state the state machine transitions to next.
default – The name of the state to transition to if none of the transitions in Choices is taken.
Reference:
- class aws_stepfunction.state.Succeed(comment: Optional[str] = None, input_path: Optional[str] = None, output_path: Optional[str] = None, id: str = _Nothing.NOTHING, type: str = 'Succeed')[source]¶
A Succeed state
("Type": "Succeed")
stops an execution successfully. The Succeed state is a useful target for Choice state branches that don’t do anything but stop the execution.Because Succeed states are terminal states, they have no Next field, and don’t need an End field.
Reference:
- class aws_stepfunction.state.Fail(comment: Optional[str] = None, id: str = _Nothing.NOTHING, type: str = 'Fail', cause: Optional[str] = None, error: Optional[str] = None)[source]¶
A Fail state
("Type": "Fail")
stops the execution of the state machine and marks it as a failure, unless it is caught by a Catch block.The Fail state only allows the use of Type and Comment fields from the set of common state fields. In addition, the Fail state allows the following fields.
- Parameters
cause – A custom failure string that you can specify for operational or diagnostic purposes.
error – An error name that you can provide for operational or diagnostic purposes.
Reference: