Skip to main content

Dramatiq Crontab

dramtiq-crontab logo: person in front of a schedule

Cron style scheduler for asynchronous Dramatiq tasks in Django.

  • setup recurring tasks via crontab syntax
  • lightweight helpers build on robust tools like Dramatiq and APScheduler
  • Sentry cron monitor support

PyPi Version Test Coverage GitHub License

Setup

You need to have Dramatiq installed and setup properly.

python3 -m pip install dramatiq-crontab
# or
python3 -m pip install 'dramatiq-crontab[sentry]'  # with sentry cron monitor support

Add dramatiq_crontab to your INSTALLED_APPS in settings.py:

# settings.py
INSTALLED_APPS = [
    "dramatiq_crontab",
    # ...
]

Finally, launch the scheduler in a separate process:

python3 manage.py crontab

Setup Redis as a lock backend (optional)

If you use Redis as a broker, you can use Redis as a lock backend as well. The lock backend is used to prevent multiple instances of the scheduler from running at the same time. This is important if you have multiple instances of your application running.

Install the Redis extra, or combine it with Sentry support:

python3 -m pip install 'dramatiq-crontab[redis]'
# or
python3 -m pip install 'dramatiq-crontab[redis,sentry]'

Then configure the Redis URL:

# settings.py
DRAMATIQ_CRONTAB = {
    "REDIS_URL": "redis://localhost:6379/0",
}

Usage

# tasks.py
import dramatiq
from dramatiq_crontab import cron


@cron("*/5 * * * *")  # every 5 minutes
@dramatiq.actor
def my_task():
    my_task.logger.info("Hello World")

Interval

If you want to run a task more frequently than once a minute, you can use the interval decorator.

# tasks.py
import dramatiq
from dramatiq_crontab import interval


@interval(seconds=30)
@dramatiq.actor
def my_task():
    my_task.logger.info("Hello World")

Please note that the interval is relative to the time the scheduler is started. For example, if you start the scheduler at 12:00:00, the first run will be at 12:00:30. However, if you restart the scheduler at 12:00:15, the first run will be at 12:00:45.

Sentry Cron Monitors

If you use Sentry you can add cron monitors to your tasks. The monitor's slug will be the actor's name. Like my_task in the example above.

The crontab command

$ python3 manage.py crontab --help
usage: manage.py crontab [-h] [--no-task-loading] [--no-heartbeat] [--version] [-v {0,1,2,3}]
                         [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color]
                         [--force-color] [--skip-checks]

Run dramatiq task scheduler for all tasks with the `cron` decorator.

options:
  -h, --help            show this help message and exit
  --no-task-loading     Don't load tasks from installed apps.
  --no-heartbeat        Don't start the heartbeat actor.

Metadata

Release files for dramatiq-crontab 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dramatiq-crontab 1.1.1
File Size Uploaded
dramatiq_crontab-1.1.1.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dramatiq-crontab 1.1.1
File Interpreter ABI Platform
dramatiq_crontab-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.2 kB

Release files / dramatiq_crontab-1.1.1.tar.gz

Download URL dramatiq_crontab-1.1.1.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b6f75c761015474d72b804ba888088210fd667595c94049b03d71107524a2ced
BLAKE2b-256 checksum
How to use checksums
f00d768927f5772b218d1ffdf41cec01e1def0e3206ec10cffcd0a2b6bc24579
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / dramatiq_crontab-1.1.1-py3-none-any.whl

Download URL dramatiq_crontab-1.1.1-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0951017e0d7a71cbd83d5f25c3fcae00d94754bcc25129c04f5db072f7b13cf5
BLAKE2b-256 checksum
How to use checksums
c809571b918534108a9a9a05fd1dcd21c2d66d4595fc1c5904d5b5c1157a9650
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page