1
1
# Django tasks Scheduler
2
2
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 ]
6
6
7
7
---
8
8
9
9
A database backed asynchronous tasks scheduler for django.
10
10
This allows remembering scheduled tasks, their parameters, etc.
11
11
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
+
12
18
## Terminology
13
19
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
+
14
42
### Queue
15
43
16
44
A queue of messages between processes (main django-app process and worker usually).
@@ -34,27 +62,14 @@ This is a subprocess of worker.
34
62
35
63
Once a worker listening to the queue becomes available, the job will be executed
36
64
37
- ### Scheduled Task Execution
65
+ ### Scheduled Job Execution
38
66
39
67
A scheduler checking the queue periodically will check whether the time the job should be executed has come, and if so,
40
68
it will queue it.
41
69
42
70
* A job is considered scheduled if it is queued to be executed, or scheduled to be executed.
43
71
* If there is no scheduler, the job will not be queued to run.
44
72
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
-
58
73
## Scheduler sequence diagram
59
74
60
75
``` mermaid
@@ -121,24 +136,24 @@ sequenceDiagram
121
136
122
137
## Reporting issues or Features requests
123
138
124
- Please report issues via [ GitHub Issues] [ 6 ] .
139
+ Please report issues via [ GitHub Issues] [ issues ] .
125
140
126
141
---
127
142
128
143
## Acknowledgements
129
144
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 ] .
131
146
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
133
148
134
149
[ 2 ] :https://github.com/django-commons/django-tasks-scheduler/actions/workflows/test.yml
135
150
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
137
152
138
- [ 4 ] :https://img.shields.io/pypi/dm/django-tasks-scheduler
153
+ [ pypi-downloads ] :https://img.shields.io/pypi/dm/django-tasks-scheduler
139
154
140
- [ 5 ] :https://pypi.org/project/django-tasks-scheduler/
155
+ [ pypi ] :https://pypi.org/project/django-tasks-scheduler/
141
156
142
- [ 6 ] :https://github.com/django-commons/django-tasks-scheduler/issues
157
+ [ issues ] :https://github.com/django-commons/django-tasks-scheduler/issues
143
158
144
- [ 7 ] :https://github.com/rq/django-rq
159
+ [ django-rq ] :https://github.com/rq/django-rq
0 commit comments