Home > Net >  Is it possible to export AWS Step Functions Graph Export with what happened in the execution?
Is it possible to export AWS Step Functions Graph Export with what happened in the execution?

Time:01-07

From AWS Step Functions Graph Export API, I am able to export the graph workflow only. Is it possible to show the states of each node? (Succeeded,Failed..etc)

CodePudding user response:

It seems possible from ListExecutions request. You can add filter of statusFilter and get the executions. Calling this API with required filters will get you the states you're looking for.

https://docs.aws.amazon.com/step-functions/latest/apireference/API_ExecutionListItem.html#StepFunctions-Type-ExecutionListItem-status

CodePudding user response:

Enumerate the executions with ListExecutions to get the execution ARNs. Then call GetExecutionHistory to get the event details for each execution.

Typescript example:

const res = await client.send( new ListExecutionsCommand({ stateMachineArn: 'arn:aws:states:us-xxxx-x-xxxxxxxxxxx',}));

const executions = res.executions ?? [];

const detailsRes = await Promise.all(
  executions.map((e) => client.send(new GetExecutionHistoryCommand({ executionArn: e.executionArn,})));
);

Event detail example from the history output:

{
  "id": 11,
  "previousEventId": 9,
  "stateExitedEventDetails": {
    "name": "AllJobs",
    "output": "[...]",
    "outputDetails": { "truncated": false }
  },
  "timestamp": "2022-01-06T19:41:37.035Z",
  "type": "ParallelStateExited"
},

Each list-execution output has a status property. The event history output includes a list of event details. The last event will have "type": "ExecutionSucceeded" if the execution succeeded and "type": "ExecutionFailed" if the execution failed.

  •  Tags:  
  • Related