start_execution
¶
start_execution(
state_machine_arn: Arn,
*,
config_overrides: Optional[SFNClientConfig] = None,
name: Optional[Name] = None,
input: Optional[SensitiveData] = None,
trace_header: Optional[TraceHeader] = None,
) -> StartExecutionOutput
Starts a state machine execution.
A qualified state machine ARN can either refer to a Distributed Map state defined within a state machine, a version ARN, or an alias ARN.
The following are some examples of qualified and unqualified state machine ARNs:
-
The following qualified state machine ARN refers to a Distributed Map state with a label
mapStateLabelin a state machine namedmyStateMachine.arn:partition:states:region:account-id:stateMachine:myStateMachine/mapStateLabelIf you provide a qualified state machine ARN that refers to a Distributed Map state, the request fails with
ValidationException. -
The following qualified state machine ARN refers to an alias named
PROD.arn::states: : :stateMachine: If you provide a qualified state machine ARN that refers to a version ARN or an alias ARN, the request starts execution for that version or alias.
-
The following unqualified state machine ARN refers to a state machine named
myStateMachine.arn::states: : :stateMachine:
If you start an execution with an unqualified state machine ARN, Step Functions uses the latest revision of the state machine for the execution.
To start executions of a state machine version, call StartExecution and provide the version ARN or the ARN of an alias that points to the version.
StartExecution is idempotent for STANDARD workflows. For a STANDARD workflow, if you call StartExecution with the same name and input as a running execution, the call succeeds and return the same response as the original request. If the execution is closed or if the input is different, it returns a 400 ExecutionAlreadyExists error. You can reuse the name 90 days after it closes.
StartExecution isn't idempotent for EXPRESS workflows.
Parameters:
-
state_machine_arn(Arn) –The Amazon Resource Name (ARN) of the state machine to execute.
The
stateMachineArnparameter accepts one of the following inputs:-
An unqualified state machine ARN – Refers to a state machine ARN that isn't qualified with a version or alias ARN. The following is an example of an unqualified state machine ARN.
arn::states: : :stateMachine: Step Functions doesn't associate state machine executions that you start with an unqualified ARN with a version. This is true even if that version uses the same revision that the execution used.
-
A state machine version ARN – Refers to a version ARN, which is a combination of state machine ARN and the version number separated by a colon (:). The following is an example of the ARN for version 10.
arn::states: : :stateMachine: :10 Step Functions doesn't associate executions that you start with a version ARN with any aliases that point to that version.
-
A state machine alias ARN – Refers to an alias ARN, which is a combination of state machine ARN and the alias name separated by a colon (:). The following is an example of the ARN for an alias named
PROD.arn::states: : :stateMachine: Step Functions associates executions that you start with an alias ARN with that alias and the state machine version used for that execution.
-
-
name(Optional[Name], default:None) –Optional name of the execution. For STANDARD workflows, this name must be unique for your Amazon Web Services account, region, and state machine. If a previous execution with the same name exists, you can reuse the name 90 days after it closes. For EXPRESS workflows, execution names can be reused immediately. For more information, see Limits Related to State Machine Executions in the Step Functions Developer Guide.
If you don't provide a name for the execution, Step Functions automatically generates a universally unique identifier (UUID) as the execution name.
A name must not contain:
-
white space
-
brackets
< > { } [ ] -
wildcard characters
? * -
special characters
" # % \ ^ | ~ ` $ & , ; : / -
control characters (
U+0000-001F,U+007F-009F,U+FFFE-FFFF) -
surrogates (
U+D800-DFFF) -
invalid characters (
U+10FFFF)
To enable logging with CloudWatch Logs, the name should only contain 0-9, A-Z, a-z, - and _.
-
-
input(Optional[SensitiveData], default:None) –The string that contains the JSON input data for the execution, for example:
"{\"first_name\" : \"Alejandro\"}"If you don't include any JSON input data, you still must include the two braces, for example:
"{}"Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.
-
trace_header(Optional[TraceHeader], default:None) –Passes the X-Ray trace header. The trace header can also be passed in the request payload.
For X-Ray traces, all Amazon Web Services services use the
X-Amzn-Trace-Idheader from the HTTP request. Using the header is the preferred mechanism to identify a trace.StartExecutionandStartSyncExecutionAPI operations can also usetraceHeaderfrom the body of the request payload. If both sources are provided, Step Functions will use the header value (preferred) over the value in the request body.
Raises:
-
ExecutionAlreadyExists–The execution has the same
nameas another execution (but a differentinput).Executions with the same
nameandinputare considered idempotent. -
ExecutionLimitExceeded–The maximum number of running executions has been reached. Running executions must end or be stopped before a new execution can be started.
-
InvalidArn–The provided Amazon Resource Name (ARN) is not valid.
-
InvalidExecutionInput–The provided JSON input data is not valid.
-
InvalidName–The provided name is not valid.
-
KmsAccessDeniedException–Either your KMS key policy or API caller does not have the required permissions.
-
KmsInvalidStateException–The KMS key is not in valid state, for example: Disabled or Deleted.
-
KmsThrottlingException–Received when KMS returns
ThrottlingExceptionfor a KMS call that Step Functions makes on behalf of the caller. -
StateMachineDeleting–The specified state machine is being deleted.
-
StateMachineDoesNotExist–The specified state machine does not exist.
-
ValidationException–The input does not satisfy the constraints specified by an Amazon Web Services service.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_sfn/_services/sfn.py
1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 | |