apscheduler.schedulers.background

class apscheduler.schedulers.background.BackgroundScheduler(gconfig={}, **options)

Bases: BlockingScheduler

A scheduler that runs in the background using a separate thread (start() will return immediately).

Extra options:

daemon

Set the daemon option in the background thread (defaults to True, see the documentation for further details)

shutdown(*args, **kwargs)

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(*args, **kwargs)

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:

API

class apscheduler.schedulers.background.BackgroundScheduler(gconfig={}, **options)

Bases: BlockingScheduler

A scheduler that runs in the background using a separate thread (start() will return immediately).

Extra options:

daemon

Set the daemon option in the background thread (defaults to True, see the documentation for further details)

shutdown(*args, **kwargs)

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(*args, **kwargs)

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:

Introduction

BackgroundScheduler runs in a thread inside your existing application. Calling start() will start the scheduler and it will continue running after the call returns.

Default executor

PoolExecutor

External dependencies

none

Example

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