celery/django-celery-beat

Public

Celery Periodic Tasks backed by the Django ORM

  • Stars2k+2 tuần này
  • Forks500
  • Watchers41
  • Issues114
  • Ngày tạo04/08/2016
  • Cập nhật gần nhất13/10/2026
  • Ngôn ngữPython
  • Giấy phép—
README.rst23.8 KBRaw

Database-backed Periodic Tasks

Build status coverage BSD License Supported Python versions. Support Python implementations.

Version:2.9.0
Web:http://django-celery-beat.readthedocs.io/
Download:http://pypi.python.org/pypi/django-celery-beat
Source:http://github.com/celery/django-celery-beat
DeepWiki:Ask http://DeepWiki.com
Keywords:django, celery, beat, periodic task, cron, scheduling

About

This extension enables you to store the periodic task schedule in the database.

The periodic tasks can be managed from the Django Admin interface, where you can create, edit and delete periodic tasks and how often they should run.

Using the Extension

Usage and installation instructions for this extension are available from the Celery documentation.

Important Warning about Time Zones

Warning

If you change the Django TIME_ZONE setting your periodic task schedule will still be based on the old timezone.

To fix that you would have to reset the "last run time" for each periodic task:

>>> from django_celery_beat.models import PeriodicTask, PeriodicTasks
>>> PeriodicTask.objects.all().update(last_run_at=None)
>>> PeriodicTasks.update_changed()

Note

This will reset the state as if the periodic tasks have never run before.

Models

  • django_celery_beat.models.PeriodicTask

This model defines a single periodic task to be run.

It must be associated with a schedule, which defines how often the task should run.

  • django_celery_beat.models.IntervalSchedule

A schedule that runs at a specific interval (e.g. every 5 seconds).

  • django_celery_beat.models.CrontabSchedule

A schedule with fields like entries in cron: minute hour day-of-week day_of_month month_of_year.

  • django_celery_beat.models.PeriodicTasks

This model is only used as an index to keep track of when the schedule has changed.

Whenever you update a PeriodicTask a counter in this table is also incremented, which tells the celery beat service to reload the schedule from the database.

If you update periodic tasks in bulk, you will need to update the counter manually:

>>> from django_celery_beat.models import PeriodicTasks
>>> PeriodicTasks

Nội dung README thuộc về celery và cộng đồng đóng góp, giấy phép Không có giấy phép. Nguồn: github.com/celery/django-celery-beat