1- # Django CronTask
1+ # Dramatiq Crontab
22
3- <p align =" center " >
4- <picture >
5- <source media="(prefers-color-scheme: dark)" srcset="./images/logo-dark.svg">
6- <source media="(prefers-color-scheme: light)" srcset="./images/logo-light.svg">
7- <img alt="esimport: Blazing fast ESM compiler and importmap generator" src="./images/logo-light.svg">
8- </picture >
9- </p >
3+ ![ dramtiq-crontab logo: person in front of a schedule] ( https://raw.githubusercontent.com/voiio/dramatiq-crontab/main/dramatiq-crontab.png )
104
11- ** Cron style scheduler for asynchronous tasks in Django.**
5+ ** Cron style scheduler for asynchronous Dramatiq tasks in Django.**
126
137- setup recurring tasks via crontab syntax
14- - lightweight helpers build [ APScheduler]
8+ - lightweight helpers build on robust tools like [ Dramatiq ] and [ APScheduler]
159- [ Sentry] cron monitor support
1610
17- [ ![ PyPi Version] ( https://img.shields.io/pypi/v/django-crontask .svg )] ( https://pypi.python.org/pypi/django-crontask / )
18- [ ![ Test Coverage] ( https://codecov.io/gh/codingjoe/django-crontask /branch/main/graph/badge.svg )] ( https://codecov.io/gh/codingjoe/django-crontask )
19- [ ![ GitHub License] ( https://img.shields.io/github/license/codingjoe/django-crontask )] ( https://raw.githubusercontent.com/codingjoe/django-crontask /master/LICENSE )
11+ [ ![ PyPi Version] ( https://img.shields.io/pypi/v/dramatiq-crontab .svg )] ( https://pypi.python.org/pypi/dramatiq-crontab / )
12+ [ ![ Test Coverage] ( https://codecov.io/gh/voiio/dramatiq-crontab /branch/main/graph/badge.svg )] ( https://codecov.io/gh/voiio/dramatiq-crontab )
13+ [ ![ GitHub License] ( https://img.shields.io/github/license/voiio/dramatiq-crontab )] ( https://raw.githubusercontent.com/voiio/dramatiq-crontab /master/LICENSE )
2014
2115## Setup
2216
23- You need to have [ Django's Task framework ] [ django-tasks ] setup properly.
17+ You need to have [ Dramatiq ] installed and setup properly.
2418
2519``` ShellSession
26- python3 -m pip install django-crontask
20+ python3 -m pip install dramatiq-crontab
2721# or
28- python3 -m pip install django-crontask [sentry] # with sentry cron monitor support
22+ python3 -m pip install dramatiq-crontab [sentry] # with sentry cron monitor support
2923```
3024
31- Add ` crontask ` to your ` INSTALLED_APPS ` in ` settings.py ` :
25+ Add ` dramatiq_crontab ` to your ` INSTALLED_APPS ` in ` settings.py ` :
3226
3327``` python
3428# settings.py
3529INSTALLED_APPS = [
36- " crontask " ,
30+ " dramatiq_crontab " ,
3731 # ...
3832]
3933```
4034
4135Finally, you lauch the scheduler in a separate process:
4236
4337``` ShellSession
44- python3 manage.py crontask
38+ python3 manage.py crontab
4539```
4640
4741### Setup Redis as a lock backend (optional)
@@ -53,7 +47,7 @@ instances of your application running.
5347
5448``` python
5549# settings.py
56- CRONTASK = {
50+ DRAMATIQ_CRONTAB = {
5751 " REDIS_URL" : " redis://localhost:6379/0" ,
5852}
5953```
@@ -62,12 +56,12 @@ CRONTASK = {
6256
6357``` python
6458# tasks.py
65- from django.tasks import task
66- from crontask import cron
59+ import dramatiq
60+ from dramatiq_crontab import cron
6761
6862
6963@cron (" */5 * * * *" ) # every 5 minutes
70- @task
64+ @dramatiq.actor
7165def my_task ():
7266 my_task.logger.info(" Hello World" )
7367```
@@ -79,12 +73,12 @@ If you want to run a task more frequently than once a minute, you can use the
7973
8074``` python
8175# tasks.py
82- from django.tasks import task
83- from crontask import interval
76+ import dramatiq
77+ from dramatiq_crontab import interval
8478
8579
8680@interval (seconds = 30 )
87- @task
81+ @dramatiq.actor
8882def my_task ():
8983 my_task.logger.info(" Hello World" )
9084```
@@ -107,7 +101,7 @@ usage: manage.py crontab [-h] [--no-task-loading] [--no-heartbeat] [--version] [
107101 [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color]
108102 [--force-color] [--skip-checks]
109103
110- Run task scheduler for all tasks with the `cron` decorator.
104+ Run dramatiq task scheduler for all tasks with the `cron` decorator.
111105
112106options:
113107 -h, --help show this help message and exit
@@ -116,5 +110,5 @@ options:
116110```
117111
118112[ apscheduler ] : https://apscheduler.readthedocs.io/en/stable/
119- [ django-tasks ] : https://docs.djangoproject.com/en/6.0/topics/tasks /
113+ [ dramatiq ] : https://dramatiq.io /
120114[ sentry ] : https://docs.sentry.io/product/crons/
0 commit comments