prefect.flow_engine
Functions
load_flow_run
load_flow
load_flow_and_flow_run
send_heartbeats_sync
send_heartbeats_async
run_flow_sync
run_flow_async
run_generator_flow_sync
run_generator_flow_async
run_flow
run_flow_in_subprocess
flow: The flow to run.flow_run: The flow run object containing run metadata.parameters: The parameters to use when invoking the flow.wait_for: The futures to wait for before starting the flow.context: A serialized context to hydrate before running the flow. If not provided, the current context will be used. A serialized context should be provided if this function is called in a separate memory space from the parent run (e.g. in a subprocess or on another machine).env: Additional environment variables to set in the subprocess.
- A multiprocessing.context.SpawnProcess representing the process that is running the flow.
Classes
FlowRunTimeoutError
Raised when a flow run exceeds its defined timeout.
BaseFlowRunEngine
Methods:
cancel_all_tasks
heartbeat_seconds
is_pending
is_running
setup_flow_run_suspension_request
state
FlowRunEngine
Methods:
begin_run
call_flow_fn
call_hooks
client
create_flow_run
handle_cancellation
capture_sigterm has determined (via the cancellation
listener) that the SIGTERM was the runner asking for cancellation,
not an unrelated termination. The same ownership rule governs the
on_cancellation hook: if the engine owns cancellation handling, it
must drive Cancelling -> Cancelled and run the hook locally; if an
external runner owns cancellation, the child avoids duplicating state
history and hooks. Engine-reported Crashed states and on_crashed
hooks always remain engine-owned.
handle_crash
handle_exception
handle_success
handle_timeout
initialize_run
load_subflow_run
result
run_context
set_state
setup_run_context
start
AsyncFlowRunEngine
Async version of the flow run engine.
NOTE: This has not been fully asyncified yet which may lead to async flows
not being fully asyncified.
Methods:
begin_run
call_flow_fn
call_hooks
client
create_flow_run
handle_cancellation
FlowRunEngine.handle_cancellation. Shielded
from asyncio cancellation so engine-owned transitions always reach
the server.