Home > Mobile >  AWS Statemachine Execution Status through aws Lambda( Python)
AWS Statemachine Execution Status through aws Lambda( Python)

Time:12-27

i have to check whether a statemachine is in running or succeeded status through aws lambda function. If it's not in running status, i will invoke the same statemachine in aws lambda . Tried this and its expecting executing ID of my statemachine. My first step is to get execution status and based on the status , i need to invoke/trigger the state machine. Is it possible to get the execution status using the StatemachineARN ?

response = client.describe_execution(
    executionArn='arn:aws:name')
    

CodePudding user response:

describe_execution is not what you want. It returns information about a specific State Machine execution. A state machine execution "occurs when an AWS Step Functions state machine runs and performs its tasks." Each execution run has its own ARN.

To get running executions for a (Standard) State Machine, call list_executions:

response = client.list_executions(
    stateMachineArn='string',
    statusFilter='RUNNING',
)
  • Related