Flow Manager
A FlowManager
is used to associate
Flow
s with
Schedule
s, and run them accordingly.
- class flow.flow_manager.FlowManager
A manager to run many flows on predetermined schedules.
- __init__(num_processes: int) None
Initialize the manager with no flows.
- Parameters:
num_processes (int) – The number of processes to use when running flows.
Flow will only be run in parallel when
pathos
is installed (seerun()
)
- add_unconf_flow(flow: Flow[Any], schedule: Schedule, config_path: str, logfiles: list[str] = [], silent: bool = True) None
Add an unconfigured flow to be run on a schedule.
- Parameters:
flow (Flow[Any]) – The configured flow to run
schedule (Schedule) – The schedule to run the flow on
config_path (str) – The path to the flow’s configurations
logfiles (list[str]) – Paths to logfiles, to record the flow’s output to. Defaults to []
silent (bool) – Whether the flow should not print output to the terminal. Defaults to True
- Raises:
Exception – Raised if the flow is configured, or if a flow with the same name is already present
Note that flows are configured/validated automatically when added, such that all flows are validated before any are run
- add_conf_flow(flow: Flow[Any], schedule: Schedule) None
Add a configured flow to be run on a schedule.
- run() None
Run the flow manager.
This will check the schedules of all flows, and run them if appropriate (each on a separate process).
FlowManager
usespathos
to runFlow
s in parallel, across multiple processes. This is necessary (usingpathos
instead of the built-inmultiprocessing
library) because flow instances (not to mention their dynamically-defined configuration types) cannot be pickled withpickle
, and must instead by pickled withdill
. Ifpathos
is not present,Flow
s will be run serially