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.1.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

django_celery_beat_rrule-0.0.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for django_celery_beat_rrule-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d3d2d63303d7aaa8a15646014ad36961cb84354a02bd66d1151820e48a755185
MD5 6a3e1283171c8eac551d30e070008cd9
BLAKE2b-256 3b43cebc11769d86742da16a152ac3fe8ca0d061eaa77fc2d78c7686c7fd9ad6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_celery_beat_rrule-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d450a1af29df1a393bcf3a3fb262a89263bd20507499bac93dbbb7dcde601af
MD5 cd3fea690f2e8459e7226a290ef79bc6
BLAKE2b-256 af105f32372e429b01825199fd36cebac03849a42d549d40421aace0363218e1

See more details on using hashes here.

Supported by

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