Skip to main content

Add a RruleDatabaseScheduler, automatically execute tasks based on custom rrule schedules

Project description

django-celery-beat-rrule

A django-celery-beat plugin that adds a RruleScheduler. It is based on the django-celery-beat's database scheduler and allows running tasks by just creating dateutil's rrule schedules.

THIS PROJECT IS IN BETA, USE AT YOUR DISCRETION.

Why?

Django-celery-beat is a wonderful library that already includes powerful schedulers like crontab, interval or solar. But what if your schedule includes irregularities? If you schedule an event on your calendar you are usually presented with a complex planner that allows you to schedule an event with multiple exceptions, breaks, different time intervals that are too complicated to be handled by crontab. This is where dateutil's rrule package comes in, it allows to easily create complex schedules with groups and exceptions that cover much more ground than crontab.

This project is intended to make this integrating this package easier for running custom events on small to medium scale.

How it works

A custom rrule-based DatabaseScheduler implementation uses an extended periodic task, that adds a new JSON field storing the serialized rrule schedule. Scheduler then is able to pick these tasks up as a regular celery-beat schedule and calculate the next execution date using rrule.after().

Known issues

  1. Potentially poor performance because of the rrule.after()'s computational overhead, specifically in complex rules with several exceptions.
  2. Underlying issues with how rrule performs validation. There are several issues open on github describing how an RRULE can be created excluding ALL dates from execution and making their computation take too long.

Installation

You can install django-celery-beat-rrule either via the Python Package Index (PyPI) or from source.

To install using pip:

   $ pip install --upgrade django-celery-beat-rrule

Configuration

Add django_celery_beat_rrule to the list of installed apps

INSTALLED_APPS = [
    ...,
    'django_celery_beat_rrule',
]

Run django-celery-beat-rrule migrations

    # make sure you have already installed django-celery-beat's migrations before you run this
    $ python manage.py migrate django_celery_beat_rrule

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_celery_beat_rrule-0.0.3.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_celery_beat_rrule-0.0.3-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file django_celery_beat_rrule-0.0.3.tar.gz.

File metadata

  • Download URL: django_celery_beat_rrule-0.0.3.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for django_celery_beat_rrule-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b1754b0e4f12c16d6dd1b39d1fd6b4220868add8408d5168640a90ab1d9bb268
MD5 ead813b603cbe2ecb370592fd1d4fe82
BLAKE2b-256 b495eec4c9aa82e19dbe0167bc8f38a8d6b197ae839b56f2a988de276d3a4c3b

See more details on using hashes here.

File details

Details for the file django_celery_beat_rrule-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for django_celery_beat_rrule-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5fa370bd4a51dc1cdd8abb87051b1ce36a074daaac1fc1255b2cd574c016bab9
MD5 8005dbe844c31d99f8ca2ea206ab3a84
BLAKE2b-256 84e4e937088d84aa273d3356b99d0777054078795d90fa70315adfd0e9d6024f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page