Created
October 31, 2018 10:37
-
-
Save SemantiveCode/1fbe284278f2a35a80b4b24c90a84392 to your computer and use it in GitHub Desktop.
Start asynchronous action Lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def async_invoke_handler(event, context): | |
activity_task_response = states_client.get_activity_task( | |
activityArn=ASYNC_ACTION_ACTIVITY_ARN, | |
workerName=context.function_name, | |
) | |
if 'taskToken' not in activity_task_response: | |
raise MissingScheduledActivityTaskException() | |
input_for_nested_execution = { | |
'task_token': activity_task_response['taskToken'], | |
'state': json.loads(activity_task_response['input']), | |
} | |
nested_execution_response = states_client.start_execution( | |
stateMachineArn=NESTED_STATE_MACHINE_ARN, | |
input=json.dumps(input_for_nested_execution), | |
) | |
return { | |
'nested_execution_arn': nested_execution_response['executionArn'], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment