Skip to main content

prefect_aws.microvm.payload

Parsing and validation of the /run lifecycle hook request.

Functions

parse_run_hook_request

Parse the body of a /run lifecycle hook request. Args:
  • body: The raw request body, a JSON object with microvmId and runHookPayload, where runHookPayload is a JSON-encoded string.
Returns:
  • The MicroVM ID and the validated payload.
Raises:
  • InvalidRunHookPayload: If the body or payload is malformed, larger than MAX_RUN_HOOK_PAYLOAD_BYTES, or has an unsupported major version.

Classes

InvalidRunHookPayload

Raised when a /run request cannot start a flow run.

RunHookPayload

The flow run to execute, as sent in the runHookPayload of a /run hook. Attributes:
  • v: The major version of the payload format.
  • flow_run_id: The ID of the flow run to execute.
  • env: Environment variables to set before the flow run starts.
  • entrypoint: A flow entrypoint such as flows/etl.py\:etl. When set, the flow is loaded from this entrypoint instead of from the deployment.
  • working_dir: The directory to run the flow from when entrypoint is set.

RunHookRequest

The body of a /run lifecycle hook request. Attributes:
  • microvm_id: The ID of the MicroVM that received the request.
  • payload: The parsed runHookPayload.