minos.networks.scheduling.schedulers
Classes
Periodic Task class. |
|
Periodic Task Scheduler class. |
- class PeriodicTaskScheduler[source]
Bases:
SetupMixin
Periodic Task Scheduler class.
- __init__(tasks, *args, **kwargs)[source]
- Parameters
tasks (set[minos.networks.scheduling.schedulers.PeriodicTask]) –
- property tasks: set[minos.networks.scheduling.schedulers.PeriodicTask]
Get the set of periodic tasks.
- Returns
A
set
ofPeriodicTask
instances.
- async start()[source]
Start the execution of periodic tasks.
- Returns
This method does not return anything.
- Return type
None
- async destroy()
Destroy miscellaneous repository things.
- Returns
This method does not return anything.
- Return type
None
- classmethod from_config(config=None, **kwargs)
Build a new instance from config.
- Parameters
config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.
kwargs – Additional named arguments.
- Returns
A instance of the called class.
- Return type
S
- async setup()
Setup miscellaneous repository things.
- Returns
This method does not return anything.
- Return type
None
- class PeriodicTask[source]
Bases:
object
Periodic Task class.
- property crontab: minos.networks.scheduling.crontab.CronTab
Get the crontab of the periodic task.
- Returns
A
CronTab
instance.
- property fn: Callable[[minos.networks.scheduling.requests.ScheduledRequest], Awaitable[None]]
Get the function to be called periodically.
- Returns
A function returning an awaitable.
- property started: bool
Check if the periodic task has been started.
- Returns
True
if started orFalse
otherwise.
- property task: _asyncio.Task
Get the asyncio task.
- Returns
An
asyncio.Task
instance.
- async start()[source]
Start the periodic task.
- Returns
This method does not return anything.
- Return type
None
- async run_forever()[source]
Run the periodic function forever. This method is equivalent to start, but it keeps waiting until infinite.
- Returns
This method never returns.
- Return type