databay.base_planner¶
See also
Extending BasePlanner to learn how to extend this class correctly.
-
class
databay.base_planner.
BasePlanner
(links: Union[Link, List[Link]] = None, ignore_exceptions: bool = False, immediate_transfer: bool = True, shutdown_at_exit: bool = False)[source]¶ databay.base_planner.BasePlanner
Base abstract class for a job planner. Implementations should handle scheduling link transfers based on
datetime.timedelta
intervals.- Parameters
links (
Link
or list[Link
]) – Links that should be added and scheduled.ignore_exceptions (
bool
) – Whether exceptions should be ignored, or halt the planner.Default:False
immediate_transfer (
bool
) – Whether this planner should execute transfer once immediately upon starting for all links that haveLink.immediate_transfer
set toTrue
.Default:True
shutdown_at_exit (bool) – Whether this planner should attempt to gracefully shutdown if the app exists unexpectedly.
Default:False
Bases:
abc.ABC
-
add_links
(self, links: Union[Link, List[Link]])[source]¶ Add new links to this planner. This can be run once planner is already running.
-
remove_links
(self, links: Link)[source]¶ Remove links from this planner. This can be run once planner is already running.
-
start
(self)[source]¶ Start this planner. Links will start being scheduled based on their intervals after calling this method. The exact methodology depends on the planner implementation used.
This will also loop over all links and call the on_start callback before starting the planner.
If
BasePlanner.immediate_transfer
is set to True, this function will additionally callLink.transfer
once for each link managed by this planner before starting.See Start and Shutdown to learn more about starting and shutdown.
-
shutdown
(self, wait: bool = True)[source]¶ Shutdown this planner. Links will stop being scheduled after calling this method. Remaining link jobs may still execute after calling this method depending on the concrete planner implementation.
This will also loop over all links and call the on_shutdown callback after shutting down the planner.
See Start and Shutdown to learn more about starting and shutdown.