minos.networks.scheduling.schedulers module¶
- class minos.networks.scheduling.schedulers.PeriodicTask(crontab, fn)[source]¶
 Bases:
objectPeriodic Task class.
- property crontab: crontab._crontab.CronTab¶
 Get the crontab of the periodic task.
- Return type
 crontab._crontab.CronTab- Returns
 A
CronTabinstance.
- property fn: Callable[[minos.networks.scheduling.requests.ScheduledRequest], Awaitable[None]]¶
 Get the function to be called periodically.
- Return type
 typing.Callable[[ScheduledRequest],Awaitable[None]]- Returns
 A function returning an awaitable.
- async run_forever()[source]¶
 Run the periodic function forever. This method is equivalent to start, but it keeps waiting until infinite.
- Return type
 typing.NoReturn- Returns
 This method never returns.
- async run_once(now=None)[source]¶
 Run the periodic function one time.
- Parameters
 now (
typing.Optional[datetime.datetime]) – An optional datetime expressing the current datetime.- Return type
 None- Returns
 This method does not return anything.
- property running: bool¶
 Check if the periodic function is running.
- Return type
 bool- Returns
 Trueif it’s running orFalseotherwise.
- async start()[source]¶
 Start the periodic task.
- Return type
 None- Returns
 This method does not return anything.
- property started: bool¶
 Check if the periodic task has been started.
- Return type
 bool- Returns
 Trueif started orFalseotherwise.
- async stop(timeout=None)[source]¶
 Stop the periodic task.
- Parameters
 timeout (
typing.Optional[float]) – An optional timeout expressed in seconds.- Return type
 None- Returns
 This method does not return anything.
- property task: _asyncio.Task¶
 Get the asyncio task.
- Return type
 _asyncio.Task- Returns
 An
asyncio.Taskinstance.
- class minos.networks.scheduling.schedulers.PeriodicTaskScheduler(tasks, *args, **kwargs)[source]¶
 Bases:
minos.common.setup.MinosSetupPeriodic Task Scheduler class.
- property already_destroyed: bool¶
 Already Destroy getter.
- Return type
 bool- Returns
 A boolean value.
- property already_setup: bool¶
 Already Setup getter.
- Return type
 bool- Returns
 A boolean value.
- async destroy()¶
 Destroy miscellaneous repository things.
- Return type
 None- Returns
 This method does not return anything.
- classmethod from_config(config=None, **kwargs)¶
 Build a new instance from config.
- Parameters
 config (
typing.Union[minos.common.configuration.config.MinosConfig,pathlib.Path,None]) – Config instance. If None is provided, default config is chosen.kwargs – Additional named arguments.
- Return type
 ~S
- Returns
 A instance of the called class.
- async setup()¶
 Setup miscellaneous repository things.
- Return type
 None- Returns
 This method does not return anything.
- async start()[source]¶
 Start the execution of periodic tasks.
- Return type
 None- Returns
 This method does not return anything.
- async stop(timeout=None)[source]¶
 Stop the execution of periodic tasks.
- Parameters
 timeout (
typing.Optional[float]) – An optional timeout expressed in seconds.- Return type
 None- Returns
 This method does not return anything.
- property tasks: set[minos.networks.scheduling.schedulers.PeriodicTask]¶
 Get the set of periodic tasks.
- Return type
 - Returns
 A
setofPeriodicTaskinstances.