Name | dramatiq-crontab JSON |
Version |
1.0.11
JSON |
| download |
home_page | None |
Summary | Cron style scheduler for asynchronous Dramatiq tasks in Django. |
upload_time | 2025-07-14 12:27:48 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
django
dramatiq
tasks
scheduler
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Dramatiq Crontab

**Cron style scheduler for asynchronous Dramatiq tasks in Django.**
* setup recurring tasks via crontab syntax
* lightweight helpers build on robust tools like [Dramatiq][dramatiq] and [APScheduler][apscheduler]
* [Sentry][sentry] cron monitor support
[](https://pypi.python.org/pypi/dramatiq-crontab/)
[](https://codecov.io/gh/voiio/dramatiq-crontab)
[](https://raw.githubusercontent.com/voiio/dramatiq-crontab/master/LICENSE)
## Setup
You need to have [Dramatiq][dramatiq] installed and setup properly.
```ShellSession
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`:
```python
# settings.py
INSTALLED_APPS = [
'dramatiq_crontab',
# ...
]
```
Finally, you lauch the scheduler in a separate process:
```ShellSession
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.
```python
# settings.py
DRAMATIQ_CRONTAB = {
"REDIS_URL": "redis://localhost:6379/0",
}
```
## Usage
```python
# 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.
```python
# 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][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
```ShellSession
$ 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.
```
[dramatiq]: https://dramatiq.io/
[apscheduler]: https://apscheduler.readthedocs.io/en/stable/
[sentry]: https://docs.sentry.io/product/crons/
Raw data
{
"_id": null,
"home_page": null,
"name": "dramatiq-crontab",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "Django, Dramatiq, tasks, scheduler",
"author": null,
"author_email": "Rust Saiargaliev <fly.amureki@gmail.com>, Johannes Maron <johannes@maron.family>, Mostafa Mohamed <mostafa.anm91@gmail.com>, Jacqueline Kraus <jacquelinekraus1992@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/9b/d8/145a084a0bc2c58962653ccf1d64810f26365774dd037f4623b9cb79461b/dramatiq_crontab-1.0.11.tar.gz",
"platform": null,
"description": "# Dramatiq Crontab\n\n\n\n**Cron style scheduler for asynchronous Dramatiq tasks in Django.**\n\n* setup recurring tasks via crontab syntax\n* lightweight helpers build on robust tools like [Dramatiq][dramatiq] and [APScheduler][apscheduler]\n* [Sentry][sentry] cron monitor support\n\n[](https://pypi.python.org/pypi/dramatiq-crontab/)\n[](https://codecov.io/gh/voiio/dramatiq-crontab)\n[](https://raw.githubusercontent.com/voiio/dramatiq-crontab/master/LICENSE)\n\n## Setup\n\nYou need to have [Dramatiq][dramatiq] installed and setup properly.\n\n```ShellSession\npython3 -m pip install dramatiq-crontab\n# or\npython3 -m pip install dramatiq-crontab[sentry] # with sentry cron monitor support\n```\n\nAdd `dramatiq_crontab` to your `INSTALLED_APPS` in `settings.py`:\n\n```python\n# settings.py\nINSTALLED_APPS = [\n 'dramatiq_crontab',\n # ...\n]\n```\n\nFinally, you lauch the scheduler in a separate process:\n\n```ShellSession\npython3 manage.py crontab\n```\n\n### Setup Redis as a lock backend (optional)\n\nIf you use Redis as a broker, you can use Redis as a lock backend as well.\nThe lock backend is used to prevent multiple instances of the scheduler\nfrom running at the same time. This is important if you have multiple\ninstances of your application running.\n\n```python\n# settings.py\nDRAMATIQ_CRONTAB = {\n \"REDIS_URL\": \"redis://localhost:6379/0\",\n}\n```\n\n## Usage\n\n```python\n# tasks.py\nimport dramatiq\nfrom dramatiq_crontab import cron\n\n\n@cron(\"*/5 * * * *\") # every 5 minutes\n@dramatiq.actor\ndef my_task():\n my_task.logger.info(\"Hello World\")\n```\n\n### Interval\n\nIf you want to run a task more frequently than once a minute, you can use the\n`interval` decorator.\n\n```python\n# tasks.py\nimport dramatiq\nfrom dramatiq_crontab import interval\n\n\n@interval(seconds=30)\n@dramatiq.actor\ndef my_task():\n my_task.logger.info(\"Hello World\")\n```\n\nPlease note that the interval is relative to the time the scheduler is started.\nFor example, if you start the scheduler at 12:00:00, the first run will be at\n12:00:30. However, if you restart the scheduler at 12:00:15, the first run will\nbe at 12:00:45.\n\n### Sentry Cron Monitors\n\nIf you use [Sentry][sentry] you can add cron monitors to your tasks.\nThe monitor's slug will be the actor's name. Like `my_task` in the example above.\n\n### The crontab command\n\n```ShellSession\n$ python3 manage.py crontab --help\nusage: manage.py crontab [-h] [--no-task-loading] [--no-heartbeat] [--version] [-v {0,1,2,3}]\n [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color]\n [--force-color] [--skip-checks]\n\nRun dramatiq task scheduler for all tasks with the `cron` decorator.\n\noptions:\n -h, --help show this help message and exit\n --no-task-loading Don't load tasks from installed apps.\n --no-heartbeat Don't start the heartbeat actor.\n```\n\n[dramatiq]: https://dramatiq.io/\n[apscheduler]: https://apscheduler.readthedocs.io/en/stable/\n[sentry]: https://docs.sentry.io/product/crons/\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Cron style scheduler for asynchronous Dramatiq tasks in Django.",
"version": "1.0.11",
"project_urls": {
"Changelog": "https://github.com/voiio/dramatiq-crontab/releases",
"Project-URL": "https://github.com/voiio/dramatiq-crontab"
},
"split_keywords": [
"django",
" dramatiq",
" tasks",
" scheduler"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b0a47346a9eb39526e6ede1458b184e8b5c3aabe7e04696bf80410ab8551554b",
"md5": "41f9b3a87b93e88d6f20d7d7998954da",
"sha256": "727baa8be76b495e83dd9bb7750e90dc22cd14f9bb394d76463359eedc00c9d3"
},
"downloads": -1,
"filename": "dramatiq_crontab-1.0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "41f9b3a87b93e88d6f20d7d7998954da",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8850,
"upload_time": "2025-07-14T12:27:46",
"upload_time_iso_8601": "2025-07-14T12:27:46.663033Z",
"url": "https://files.pythonhosted.org/packages/b0/a4/7346a9eb39526e6ede1458b184e8b5c3aabe7e04696bf80410ab8551554b/dramatiq_crontab-1.0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9bd8145a084a0bc2c58962653ccf1d64810f26365774dd037f4623b9cb79461b",
"md5": "723d5df9c37ddf3a72f136c2ee894233",
"sha256": "4ba88d1a47bc7084e999717c1db238f648f6afa4253e4576b1541da559369b89"
},
"downloads": -1,
"filename": "dramatiq_crontab-1.0.11.tar.gz",
"has_sig": false,
"md5_digest": "723d5df9c37ddf3a72f136c2ee894233",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 8137,
"upload_time": "2025-07-14T12:27:48",
"upload_time_iso_8601": "2025-07-14T12:27:48.056633Z",
"url": "https://files.pythonhosted.org/packages/9b/d8/145a084a0bc2c58962653ccf1d64810f26365774dd037f4623b9cb79461b/dramatiq_crontab-1.0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-14 12:27:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "voiio",
"github_project": "dramatiq-crontab",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "dramatiq-crontab"
}