flow_engine
prefect.flow_engine
Functions
load_flow_run
load_flow
load_flow_and_flow_run
run_flow_sync
run_generator_flow_sync
run_flow
run_flow_in_subprocess
Run a flow in a subprocess.
Note the result of the flow will only be accessible if the flow is configured to persist its result.
Args:
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).
Returns:
- 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:
state
is_running
is_pending
cancel_all_tasks
FlowRunEngine
Methods:
client
begin_run
set_state
result
handle_success
handle_exception
handle_timeout
handle_crash
load_subflow_run
This method attempts to load an existing flow run for a subflow task run, if appropriate.
If the parent task run is in a final but not COMPLETED state, and not being rerun, then we attempt to load an existing flow run instead of creating a new one. This will prevent the engine from running the subflow again.
If no existing flow run is found, or if the subflow should be rerun, then no flow run is returned.
create_flow_run
call_hooks
setup_run_context
initialize_run
Enters a client context and creates a flow run if needed.
start
run_context
call_flow_fn
Convenience method to call the flow function. Returns a coroutine if the flow is async.
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: