This document describes the current stable version of Celery (4.0). For development docs, go here.
celery.beat
¶
The periodic task scheduler.
-
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.
-
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 new instance, with date and count fields updated.
-
options
= None¶ Task execution options.
-
total_run_count
= 0¶ Total number of times this task has been scheduled.
-
-
class
celery.beat.
Scheduler
(app, schedule=None, max_interval=None, Producer=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’s important for subclasses to be idempotent when this argument is set.Parameters: - schedule (schedule) – see
schedule
. - max_interval (int) – see
max_interval
. - lazy (bool) – Don’t set up the schedule.
-
Entry
¶ alias of
ScheduleEntry
-
info
¶
-
logger
= <logging.Logger object>¶
-
max_interval
= 300¶ Maximum time to sleep between re-checking the schedule.
-
schedule
¶ The schedule dict/shelve.
-
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
(event_t=<class 'celery.beat.event_t'>, min=<built-in function min>, heappop=<built-in function heappop>, heappush=<built-in function heappush>, heapify=<built-in function heapify>, mktime=<built-in function mktime>)[source]¶ Run a tick - one iteration of the scheduler.
Executes one due task per call.
Returns: preferred delay in seconds for next call. Return type: float
- schedule (schedule) – see
-
class
celery.beat.
PersistentScheduler
(*args, **kwargs)[source]¶ Scheduler backed by
shelve
database.-
info
¶
-
known_suffixes
= (u'', u'.db', u'.dat', u'.bak', u'.dir')¶
-
persistence
= <module 'shelve' from '/usr/lib/python2.7/shelve.pyc'>¶
-
schedule
¶
-
-
class
celery.beat.
Service
(app, max_interval=None, schedule_filename=None, scheduler_cls=None)[source]¶ Celery periodic task service.
-
scheduler_cls
¶ alias of
PersistentScheduler
-
-
celery.beat.
EmbeddedService
(app, max_interval=None, **kwargs)[source]¶ Return embedded clock service.
Parameters: thread (bool) – Run threaded instead of as a separate process. Uses multiprocessing
by default, if available.