celery.beat
¶
The periodic task scheduler.
- celery.beat.EmbeddedService(app, max_interval=None, **kwargs)[源代码]¶
Return embedded clock service.
- 参数:
thread (bool) -- Run threaded instead of as a separate process. Uses
multiprocessing
by default, if available.
- class celery.beat.PersistentScheduler(*args, **kwargs)[源代码]¶
Scheduler backed by
shelve
database.- property info¶
- known_suffixes = ('', '.db', '.dat', '.bak', '.dir')¶
- persistence = <module 'shelve' from '/opt/hostedtoolcache/Python/3.12.10/x64/lib/python3.12/shelve.py'>¶
- property schedule¶
- class celery.beat.ScheduleEntry(name=None, task=None, last_run_at=None, total_run_count=None, schedule=None, args=(), kwargs=None, options=None, relative=False, app=None)[源代码]¶
An entry in the scheduler.
- 参数:
args (Tuple) -- see
args
.kwargs (Dict) -- see
kwargs
.options (Dict) -- see
options
.last_run_at (datetime) -- see
last_run_at
.total_run_count (int) -- see
total_run_count
.relative (bool) -- Is the time relative to when the server starts?
- 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)[源代码]¶
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.- 参数:
max_interval (int) -- see
max_interval
.lazy (bool) -- Don't set up the schedule.
- Entry¶
ScheduleEntry
的别名
- property connection¶
- property info¶
- logger = <Logger celery.beat (WARNING)>¶
- max_interval = 300¶
Maximum time to sleep between re-checking the schedule.
- populate_heap(event_t=<class 'celery.beat.event_t'>, heapify=<built-in function heapify>)[源代码]¶
Populate the heap with the data contained in the schedule.
- property producer¶
- property 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.