Skip to content

Instantly share code, notes, and snippets.

@xbrianh
Created July 6, 2018 22:39
Show Gist options
  • Save xbrianh/f0acb4086e03696f6df44ab66315873c to your computer and use it in GitHub Desktop.
Save xbrianh/f0acb4086e03696f6df44ab66315873c to your computer and use it in GitHub Desktop.
Search for Visitation Lambda service errors
#!/usr/bin/env python
import boto3
sf = boto3.client("stepfunctions")
failed = sf.list_executions(
stateMachineArn="arn:aws:states:us-east-1:861229788715:stateMachine:dss-visitation-dev",
statusFilter="FAILED",
)['executions']
def events(execution_arn):
for page in sf.get_paginator("get_execution_history").paginate(executionArn=execution_arn):
for e in page['events']:
yield e
for ex in failed:
print(ex['startDate'], ex['executionArn'])
for e in events(ex['executionArn']):
try:
print(e['timestamp'], e['lambdaFunctionFailedEventDetails'])
except KeyError:
continue
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment