A database backed job scheduler for Django RQ with Django
Project description
Django RQ Scheduler
A database backed job scheduler for Django RQ. Based on original django-rq-scheduler - Now supports Django 4.0.
Requirements
Currently, when you pip install Django RQ Scheduler the following packages are also installed.
- django >= 3.2
- django-model-utils >= 4.2.0
- django-rq >= 2.4.1
- rq-scheduler >= 0.11.0
- pytz >= 2021.3
- croniter >= 1.2.0
Testing also requires:
- factory_boy >= 2.11.1
Usage
Install
Use pip to install:
pip install django-rq-scheduler
Update Django Settings
-
In
settings.py
, adddjango_rq
andscheduler
toINSTALLED_APPS
:INSTALLED_APPS = [ ... 'django_rq', 'scheduler', ... ]
-
Configure Django RQ. See https://github.com/ui/django-rq#installation
Migrate
The last step is migrate the database:
./manage.py migrate
Creating a Job
See http://python-rq.org/docs/jobs/ or https://github.com/ui/django-rq#job-decorator
An example:
myapp.jobs.py
@job
def count():
return 1 + 1
Scheduling a Job
Scheduled Job
-
Sign into the Django Admin site, http://localhost:8000/admin/ and locate the Django RQ Scheduler section.
-
Click on the Add link for Scheduled Job.
-
Enter a unique name for the job in the Name field.
-
In the Callable field, enter a Python dot notation path to the method that defines the job. For the example above, that would be
myapp.jobs.count
-
Choose your Queue. Side Note: The queues listed are defined in the Django Settings.
-
Enter the time the job is to be executed in the Scheduled time field. Side Note: Enter the date via the browser's local timezone, the time will automatically convert UTC.
-
Click the Save button to schedule the job.
Repeatable Job
-
Sign into the Django Admin site, http://localhost:8000/admin/ and locate the Django RQ Scheduler section.
-
Click on the Add link for Repeatable Job
-
Enter a unique name for the job in the Name field.
-
In the Callable field, enter a Python dot notation path to the method that defines the job. For the example above, that would be
myapp.jobs.count
-
Choose your Queue. Side Note: The queues listed are defined in the Django Settings.
-
Enter the time the first job is to be executed in the Scheduled time field. Side Note: Enter the date via the browser's local timezone, the time will automatically convert UTC.
-
Enter an Interval, and choose the Interval unit. This will calculate the time before the function is called again.
-
In the Repeat field, enter the number of time the job is to be ran. Leaving the field empty, means the job will be scheduled to run forever.
-
Click the Save button to schedule the job.
Reporting issues or Features
Please report issues via GitHub Issues .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-rq-scheduler-2022.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf34daa2fdbdc717ca502c7e0a7295c895632c1ac4c549604c77e42a9e4def9d |
|
MD5 | 3c349edcf956eb106c84bfbd0cb7ca06 |
|
BLAKE2b-256 | 3159bac425be70dd9527b26e3bec65c4d5c9f059ee14f4983de20e612a280279 |
Hashes for django_rq_scheduler-2022.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4da985eef7ac2545c2d10dfafe5d1b11532c923b5ad956febd0594c8bd7627e |
|
MD5 | bbf8a46d82bde089252be660edd3189e |
|
BLAKE2b-256 | 7fd2fd2d3aff4bfd0b77bcdc13b862b7f60ec6d89b5a9f2786161763b169aa77 |