Skip to main content
Valkyrie can call an AWS Lambda function after a run finishes and its results are saved, for example to send a notification or start your own analysis. Valkyrie calls the function with the Tracker’s own AWS credentials, so the function must be in the Tracker’s AWS account or allow that account to invoke it. A local Tracker can’t call Lambda functions.

Write the handler

lambda_function.py

Name the function when you start a run

To call another function when a rerun finishes, pass --lambda to valkyrie run resume or valkyrie run retry.

When the function runs

  • Valkyrie checks that it can invoke the function when the run starts, and the run fails if it can’t.
  • The function runs once, after every task has finished, and only if the run ends as FINISHED. A stopped run doesn’t call it.
  • Resuming or retrying the run calls it again when the rerun finishes.
  • A function that fails, by raising an exception or returning a statusCode of 400 or more, doesn’t change the run’s status. To confirm that the function ran, check its own logs.

Payload

The function receives the run’s launch settings, plus its ID and benchmark name. These are the fields most handlers need: