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.

close()[源代码]
get_schedule()[源代码]
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
set_schedule(schedule)[源代码]
setup_schedule()[源代码]
sync()[源代码]
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 = None

Positional arguments to apply.

default_now()[源代码]
editable_fields_equal(other)[源代码]
is_due()[源代码]

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 new instance, with date and count fields updated.

options = None

Task execution options.

schedule = None

The schedule (schedule)

total_run_count = 0

Total number of times this task has been scheduled.

update(other)[源代码]

Update values from another entry.

Will only update "editable" fields:

task, schedule, args, kwargs, options.

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.

参数:
Entry

ScheduleEntry 的别名

add(**kwargs)[源代码]
adjust(n, drift=-0.01)[源代码]
apply_async(entry, producer=None, advance=True, **kwargs)[源代码]
apply_entry(entry, producer=None)[源代码]
close()[源代码]
property connection
get_schedule()[源代码]
property info
install_default_entries(data)[源代码]
is_due(entry)[源代码]
logger = <Logger celery.beat (WARNING)>
max_interval = 300

Maximum time to sleep between re-checking the schedule.

merge_inplace(b)[源代码]
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
reserve(entry)[源代码]
property schedule

The schedule dict/shelve.

schedules_equal(old_schedules, new_schedules)[源代码]
send_task(*args, **kwargs)[源代码]
set_schedule(schedule)[源代码]
setup_schedule()[源代码]
should_sync()[源代码]
sync()[源代码]
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>)[源代码]

Run a tick - one iteration of the scheduler.

Executes one due task per call.

返回:

preferred delay in seconds for next call.

返回类型:

float

update_from_dict(dict_)[源代码]
exception celery.beat.SchedulingError[源代码]

An error occurred while scheduling a task.

class celery.beat.Service(app, max_interval=None, schedule_filename=None, scheduler_cls=None)[源代码]

Celery periodic task service.

get_scheduler(lazy=False, extension_namespace='celery.beat_schedulers')[源代码]
property scheduler
scheduler_cls

PersistentScheduler 的别名

start(embedded_process=False)[源代码]
stop(wait=False)[源代码]
sync()[源代码]