This document describes the current stable version of Celery (3.1). For development docs, go here.

celery.beat

celery.beat

The periodic task scheduler.

exception celery.beat.SchedulingError[source]

An error occured while scheduling a task.

class celery.beat.ScheduleEntry(name=None, task=None, last_run_at=None, total_run_count=None, schedule=None, args=(), kwargs={}, options={}, relative=False, app=None)[source]

An entry in the scheduler.

Parameters:
args = None

Positional arguments to apply.

is_due()[source]

See is_due().

kwargs = None

Keyword arguments to apply.

last_run_at = None

The time and date of when this task was last scheduled.

name = None

The task name

next(last_run_at=None)

Return a new instance of the same class, but with its date and count fields updated.

options = None

Task execution options.

schedule = None

The schedule (run_every/crontab)

total_run_count = 0

Total number of times this task has been scheduled.

update(other)[source]

Update values from another entry.

Does only update “editable” fields (task, schedule, args, kwargs, options).

class celery.beat.Scheduler(app, schedule=None, max_interval=None, Publisher=None, lazy=False, sync_every_tasks=None, **kwargs)[source]

Scheduler for periodic tasks.

The celery beat program may instantiate this class multiple times for introspection purposes, but then with the lazy argument set. It is important for subclasses to be idempotent when this argument is set.

Parameters:
  • schedule – see schedule.
  • max_interval – see max_interval.
  • lazy – Do not set up the schedule.
Entry

alias of ScheduleEntry

add(**kwargs)[source]
apply_async(entry, publisher=None, **kwargs)[source]
close()[source]
connection[source]
get_schedule()[source]
info
install_default_entries(data)[source]
logger = <celery.utils.log.ProcessAwareLogger object>
max_interval = 300

Maximum time to sleep between re-checking the schedule.

maybe_due(entry, publisher=None)[source]
merge_inplace(b)[source]
publisher[source]
reserve(entry)[source]
schedule

The schedule dict/shelve.

send_task(*args, **kwargs)[source]
set_schedule(schedule)[source]
setup_schedule()[source]
should_sync()[source]
sync()[source]
sync_every = 180

How often to sync the schedule (3 minutes by default)

sync_every_tasks = None

How many tasks can be called before a sync is forced.

tick()[source]

Run a tick, that is one iteration of the scheduler.

Executes all due tasks.

update_from_dict(dict_)[source]
class celery.beat.PersistentScheduler(*args, **kwargs)[source]
close()[source]
get_schedule()[source]
info
known_suffixes = ('', '.db', '.dat', '.bak', '.dir')
persistence = <module 'shelve' from '/usr/lib/python2.7/shelve.pyc'>
schedule
set_schedule(schedule)[source]
setup_schedule()[source]
sync()[source]
class celery.beat.Service(app, max_interval=None, schedule_filename=None, scheduler_cls=None)[source]
get_scheduler(lazy=False)[source]
scheduler[source]
scheduler_cls

alias of PersistentScheduler

start(embedded_process=False, drift=-0.01)[source]
stop(wait=False)[source]
sync()[source]
celery.beat.EmbeddedService(app, max_interval=None, **kwargs)[source]

Return embedded clock service.

Parameters:thread – Run threaded instead of as a separate process. Uses multiprocessing by default, if available.