scheduling#
+scheduling#
Generic python scheduler.
- -class Scheduler(name)[source]# -
- Bases: +class Scheduler(name)[source]# +- object- Bases: - object- Schedule the execution of coroutines and keep track of them. - When instantiating a - Scheduler, a name must be provided. This name is used to distinguish the instance’s log messages from other instances. Using the name of the class or module containing @@ -437,79 +441,79 @@ the same ID used to schedule it.- Any exception raised in a scheduled task is logged when the task is done. - -__contains__(task_id)[source]# -
- Return +__contains__(task_id)[source]# +- Trueif a task with the given- task_idis currently scheduled.- Return - Trueif a task with the given- task_idis currently scheduled.
 - -cancel(task_id)[source]# +cancel(task_id)[source]#
- Unschedule the task identified by - task_id. Log a warning if the task doesn’t exist.
 - -schedule(task_id, coroutine)[source]# +schedule(task_id, coroutine)[source]#
- Schedule the execution of a - coroutine.- If a task with - task_idalready exists, close- coroutineinstead of scheduling it. This prevents unawaited coroutine warnings. Don’t pass a coroutine that’ll be re-used elsewhere.
 - -schedule_at(time, task_id, coroutine)[source]# +schedule_at(time, task_id, coroutine)[source]#
- Schedule - coroutineto be executed at the given- time.- If @@ -519,33 +523,33 @@ prevents unawaited coroutine warnings. Don’t pass a coroutine that’ll be re-- timeis timezone aware, then use that timezone to calculate now() when subtracting. If- timeis naïve, then use UTC.- Parameters:
- 
-
- time ( - datetime) – The time to start the task. 
-
- task_id ( - Hashable) – A unique ID to create the task with. 
-
- coroutine ( - Coroutine) – The function to be called. 
+
- time ( - datetime) – The time to start the task. 
+
- task_id ( - Hashable) – A unique ID to create the task with. 
+
- coroutine ( - Coroutine) – The function to be called.
 
- Return type: -
- 
+
 
 - -schedule_later(delay, task_id, coroutine)[source]# +schedule_later(delay, task_id, coroutine)[source]#
- Schedule - coroutineto be executed after- delayseconds.- If a task with - task_idalready exists, close- coroutineinstead of scheduling it. This prevents unawaited coroutine warnings. Don’t pass a coroutine that’ll be re-used elsewhere.- Parameters:
- 
-
- delay ( - Union[- int,- float]) – How long to wait before starting the task. 
-
- task_id ( - Hashable) – A unique ID to create the task with. 
-
- coroutine ( - Coroutine) – The function to be called. 
+
- delay ( - Union[- int,- float]) – How long to wait before starting the task. 
+
- task_id ( - Hashable) – A unique ID to create the task with. 
+
- coroutine ( - Coroutine) – The function to be called.
 
- Return type: -
- 
+
 
 - -create_task(coro, *, suppressed_exceptions=(), event_loop=None, **kwargs)[source]# -
- Wrapper for creating an +create_task(coro, *, suppressed_exceptions=(), event_loop=None, **kwargs)[source]# +- asyncio.Taskwhich logs exceptions raised in the task.- Wrapper for creating an - asyncio.Taskwhich logs exceptions raised in the task.- If the - event_loopkwarg is provided, the task is created from that event loop, otherwise the running loop is used.- Parameters:
- 
-
- coro ( - Coroutine[- Any,- Any,- TypeVar(- TASK_RETURN)]) – The function to call. 
-
- suppressed_exceptions ( - tuple[- type[- Exception]]) – Exceptions to be handled by the task. 
-
- event_loop ( - asyncio.AbstractEventLoop) – The loop to create the task from. 
-
- kwargs – Passed to - asyncio.create_task(). 
+
- coro ( - Coroutine[- Any,- Any,- TypeVar(- TASK_RETURN)]) – The function to call. 
+
- suppressed_exceptions ( - tuple[- type[- Exception]]) – Exceptions to be handled by the task. 
+
- event_loop ( - asyncio.AbstractEventLoop) – The loop to create the task from. 
+
- kwargs – Passed to - asyncio.create_task().
 
- Returns:
- The wrapped task. 
- Return type: -
- 
+