Skip to content

Instantly share code, notes, and snippets.

@SemantiveCode
Created October 31, 2018 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SemantiveCode/1fbe284278f2a35a80b4b24c90a84392 to your computer and use it in GitHub Desktop.
Save SemantiveCode/1fbe284278f2a35a80b4b24c90a84392 to your computer and use it in GitHub Desktop.
Start asynchronous action Lambda
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