freezing-van-87649
10/01/2021, 1:42 AMbillowy-army-68599
10/01/2021, 1:45 AMfreezing-van-87649
10/01/2021, 1:47 AMbillowy-army-68599
10/01/2021, 1:50 AMJSON.stringify
on a map, right?freezing-van-87649
10/01/2021, 1:54 AMsubmitJob
.next(waitX)
.next(getStatus)
.next(new sfn.Choice(this, 'Job Complete?')
// Look at the "status" field
.when(sfn.Condition.stringEquals('$.status', 'FAILED'), jobFailed)
.when(sfn.Condition.stringEquals('$.status', 'SUCCEEDED'), finalStatus)
.otherwise(waitX));
Python step function sdk:
lambda_state = LambdaStep(
state_id="Convert HelloWorld to Base64",
parameters={
"FunctionName": "MyLambda", #replace with the name of your function
"Payload": {
"input": "HelloWorld"
}
}
)
lambda_state.add_retry(Retry(
error_equals=["States.TaskFailed"],
interval_seconds=15,
max_attempts=2,
backoff_rate=4.0
))
lambda_state.add_catch(Catch(
error_equals=["States.TaskFailed"],
next_step=Fail("LambdaTaskFailed")
))
hallowed-train-1850
10/18/2021, 2:04 AMbillowy-army-68599
10/18/2021, 2:06 AMhallowed-train-1850
10/18/2021, 2:33 AMfrom stepfunctions.steps import LambdaStep, ChoiceRule, Choice
from stepfunctions.steps.states import Choice, Chain, Retry, Succeed, Fail
from modules.pulumi.statemachine import StepFunctionStateMachine
from modules.pulumi.workflow import LambdaWorkflow
do_X = LambdaStep(
state_id="DoX",
parameters={
"FunctionName": "$.do_Z",
"Payload.$": "$"
},
output_path="$.Payload"
)
do_X.add_retry(Retry(
error_equals=["Lambda.ServiceException","Lambda.AWSLambdaException","Lambda.SdkClientException"],
interval_seconds=2,
max_attempts=6,
backoff_rate=2
))
does_y_hold_true = Choice(
state_id="DoesYHoldTrue?",
)
do_Z = LambdaStep(
state_id="DoZ",
parameters={
"FunctionName": "$.do_Z",
"Payload.$": "$"
},
output_path="$.Payload"
)
do_Z.add_retry(Retry(
error_equals=["Lambda.ServiceException","Lambda.AWSLambdaException","Lambda.SdkClientException"],
interval_seconds=2,
max_attempts=6,
backoff_rate=2
))
success = Succeed(
state_id="Succeed"
)
fail = Fail(
state_id="Fail"
)
do_X.next(
next_step=does_y_hold_true
)
does_y_hold_true.add_choice(
ChoiceRule.StringEquals(
variable="$.yHoldsTrue",
value="true"
),
next_step=do_Z
)
terms_and_conditions_accepted.default_choice(fail)
do_Z.next(success)
workflow = Workflow(
workflow_name,
role=account_role,
definition=Chain([do_X])
from pulumi_aws import iam, provider, Provider, sfn
stateMachine = sfn.StateMachine(
f'{name}StateMachine',
type="STANDARD",
role_arn=stateMachineRole.arn,
definition=workflow.definition.to_json(pretty=True)
)
billowy-army-68599
10/18/2021, 2:38 AMhallowed-train-1850
10/18/2021, 2:41 AMfreezing-van-87649
10/18/2021, 2:45 AM