11# Django tasks Scheduler
22
3- [ ![ Django CI] [ 1 ]] [ 2 ]
4- ![ badge] [ 3 ]
5- [ ![ badge] [ 4 ]] [ 5 ]
3+ [ ![ Django CI] [ badge ]] [ 2 ]
4+ ![ badge] [ coverage ]
5+ [ ![ badge] [ pypi-downloads ]] [ pypi ]
66
77---
88
99A database backed asynchronous tasks scheduler for django.
1010This allows remembering scheduled tasks, their parameters, etc.
1111
12+ !!! Important
13+ Version 3.0.0 introduced a major design change. Instead of three separate models, there is one new ` Task ` model.
14+ The goal is to simplify.
15+ Make sure to follow [ the migration guide] ( migrate_to_v3.md )
16+
17+
1218## Terminology
1319
20+ ### Scheduled Task
21+
22+ Starting v3.0.0, django-tasks-scheduler is using a single ` Task ` model with different task types, the task types are:
23+
24+ - ` ONCE ` - Run the task once at a scheduled time.
25+ - ` REPEATABLE ` - Run the task multiple times (limited number of times or infinite times) based on a time interval.
26+ - ` CRON ` - Run a task indefinitely based on a cron string schedule.
27+
28+ This enables having one admin view for all scheduled tasks, and having one table in the database to maintain the task
29+ reduces the number of overall queries.
30+ An ` Task ` instance contains all relevant information about a task to enable the users to schedule using django-admin and
31+ track their status.
32+
33+ Previously, there were three different models for ScheduledTask. These exist for legacy purposes and are scheduled to
34+ be removed.
35+
36+ * ` Scheduled Task ` - Run a task once, on a specific time (can be immediate).
37+ * ` Repeatable Task ` - Run a task multiple times (limited number of times or infinite times) based on an interval
38+ * ` Cron Task ` - Run a task multiple times (limited number of times or infinite times) based on a cron string
39+
40+ Scheduled tasks are scheduled when the django application starts, and after a scheduled task is executed.
41+
1442### Queue
1543
1644A queue of messages between processes (main django-app process and worker usually).
@@ -34,27 +62,14 @@ This is a subprocess of worker.
3462
3563Once a worker listening to the queue becomes available, the job will be executed
3664
37- ### Scheduled Task Execution
65+ ### Scheduled Job Execution
3866
3967A scheduler checking the queue periodically will check whether the time the job should be executed has come, and if so,
4068it will queue it.
4169
4270* A job is considered scheduled if it is queued to be executed, or scheduled to be executed.
4371* If there is no scheduler, the job will not be queued to run.
4472
45- ### Scheduled Task
46-
47- django models storing information about jobs. So it is possible to schedule using
48- django-admin and track their status.
49-
50- There are three types of ScheduledTask.
51-
52- * ` Scheduled Task ` - Run a job once, on a specific time (can be immediate).
53- * ` Repeatable Task ` - Run a job multiple times (limited number of times or infinite times) based on an interval
54- * ` Cron Task ` - Run a job multiple times (limited number of times or infinite times) based on a cron string
55-
56- Scheduled jobs are scheduled when the django application starts, and after a scheduled task is executed.
57-
5873## Scheduler sequence diagram
5974
6075``` mermaid
@@ -121,24 +136,24 @@ sequenceDiagram
121136
122137## Reporting issues or Features requests
123138
124- Please report issues via [ GitHub Issues] [ 6 ] .
139+ Please report issues via [ GitHub Issues] [ issues ] .
125140
126141---
127142
128143## Acknowledgements
129144
130- A lot of django-admin views and their tests were adopted from [ django-rq] [ 7 ] .
145+ A lot of django-admin views and their tests were adopted from [ django-rq] [ django-rq ] .
131146
132- [ 1 ] :https://github.com/django-commons/django-tasks-scheduler/actions/workflows/test.yml/badge.svg
147+ [ badge ] :https://github.com/django-commons/django-tasks-scheduler/actions/workflows/test.yml/badge.svg
133148
134149[ 2 ] :https://github.com/django-commons/django-tasks-scheduler/actions/workflows/test.yml
135150
136- [ 3 ] :https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/cunla/b756396efb895f0e34558c980f1ca0c7/raw/django-tasks-scheduler-4.json
151+ [ coverage ] :https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/cunla/b756396efb895f0e34558c980f1ca0c7/raw/django-tasks-scheduler-4.json
137152
138- [ 4 ] :https://img.shields.io/pypi/dm/django-tasks-scheduler
153+ [ pypi-downloads ] :https://img.shields.io/pypi/dm/django-tasks-scheduler
139154
140- [ 5 ] :https://pypi.org/project/django-tasks-scheduler/
155+ [ pypi ] :https://pypi.org/project/django-tasks-scheduler/
141156
142- [ 6 ] :https://github.com/django-commons/django-tasks-scheduler/issues
157+ [ issues ] :https://github.com/django-commons/django-tasks-scheduler/issues
143158
144- [ 7 ] :https://github.com/rq/django-rq
159+ [ django-rq ] :https://github.com/rq/django-rq
0 commit comments