Skip to main content

prefect_aws.microvm.supervisor

Runs a flow run in a forked child process and reports the child’s crashes.

Functions

execute_flow_run

Run the flow run described by payload in the current process. Args:
  • payload: The flow run to execute. If it has an entrypoint, the flow is loaded from that entrypoint, relative to working_dir when one is given. Otherwise the flow is loaded from the flow run’s deployment.

run_child

Run the flow run in a forked child process, then exit the process. The exit code is 0 when the flow run finishes without raising and nonzero otherwise. Args:
  • payload: The flow run to execute.

supervise_flow_run

Run the flow run in a forked child and wait for the child to exit. If the child exits nonzero or is killed by a signal, Crashed is proposed for the flow run. SIGTERM sent to this process is forwarded to the child. Call this from the main thread. Args:
  • payload: The flow run to execute.
Returns:
  • The exit code for this process: 0 if the child exited 0, otherwise 1.

describe_child_exit

Describe how a child process ended, from its os.waitpid status. Args:
  • wait_status: The status returned by os.waitpid.
Returns:
  • None if the child exited 0, otherwise a phrase such as
  • "was killed by signal 9" or "exited with code 1".

report_crash

Propose Crashed for a flow run. A flow run in a final state keeps it. Args:
  • flow_run_id: The ID of the flow run.
  • crash_reason: How the flow run’s process ended, for the state message.