apscheduler.schedulers.asyncio

class apscheduler.schedulers.asyncio.AsyncIOScheduler(gconfig={}, **options)

Bases: BaseScheduler

A scheduler that runs on an asyncio (PEP 3156) event loop.

The default executor can run jobs based on native coroutines (async def).

Extra options:

event_loop

AsyncIO event loop to use (defaults to the global event loop)

shutdown(wait=True)

Shuts down the scheduler, along with its executors and job stores.

Does not interrupt any currently running jobs.

Parameters:

wait (bool) – True to wait until all currently executing jobs have finished

Raises:

SchedulerNotRunningError – if the scheduler has not been started yet

start(paused=False)

Start the configured executors and job stores and begin processing scheduled jobs.

Parameters:

paused (bool) – if True, don’t start job processing until resume() is called

Raises:
wakeup()

Notifies the scheduler that there may be jobs due for execution. Triggers _process_jobs() to be run in an implementation specific manner.

API

class apscheduler.schedulers.asyncio.AsyncIOScheduler(gconfig={}, **options)

Bases: BaseScheduler

A scheduler that runs on an asyncio (PEP 3156) event loop.

The default executor can run jobs based on native coroutines (async def).

Extra options:

event_loop

AsyncIO event loop to use (defaults to the global event loop)

shutdown(wait=True)

Shuts down the scheduler, along with its executors and job stores.

Does not interrupt any currently running jobs.

Parameters:

wait (bool) – True to wait until all currently executing jobs have finished

Raises:

SchedulerNotRunningError – if the scheduler has not been started yet

start(paused=False)

Start the configured executors and job stores and begin processing scheduled jobs.

Parameters:

paused (bool) – if True, don’t start job processing until resume() is called

Raises:
wakeup()

Notifies the scheduler that there may be jobs due for execution. Triggers _process_jobs() to be run in an implementation specific manner.

Introduction

AsyncIOScheduler was meant to be used with the AsyncIO event loop. By default, it will run jobs in the event loop’s thread pool.

If you have an application that runs on an AsyncIO event loop, you will want to use this scheduler.

Default executor

AsyncIOExecutor

External dependencies

none

Example

examples/schedulers/asyncio_.py (view online).