8
8
---
9
9
10
10
A database backed async tasks scheduler for django.
11
- This allows remembering scheduled jobs , their parameters, etc.
11
+ This allows remembering scheduled tasks , their parameters, etc.
12
12
13
13
## Terminology
14
14
@@ -17,7 +17,7 @@ This allows remembering scheduled jobs, their parameters, etc.
17
17
A queue of messages between processes (main django-app process and worker usually).
18
18
This is implemented in ` rq ` package.
19
19
20
- * A queue contains multiple registries for scheduled jobs , finished jobs, failed jobs, etc.
20
+ * A queue contains multiple registries for scheduled tasks , finished jobs, failed jobs, etc.
21
21
22
22
### Worker
23
23
@@ -36,26 +36,26 @@ This is a sub-process of worker.
36
36
Once a worker listening to the queue becomes available,
37
37
the job will be executed
38
38
39
- ### Scheduled Job Execution
39
+ ### Scheduled Task Execution
40
40
41
41
A scheduler checking the queue periodically will check
42
42
whether the time the job should be executed has come, and if so, it will queue it.
43
43
44
44
* A job is considered scheduled if it is queued to be executed, or scheduled to be executed.
45
45
* If there is no scheduler, the job will not be queued to run.
46
46
47
- ### Scheduled Job
47
+ ### Scheduled Task
48
48
49
49
django models storing information about jobs. So it is possible to schedule using
50
50
django-admin and track their status.
51
51
52
- There are 3 types of scheduled job .
52
+ There are 3 types of scheduled task .
53
53
54
- * ` Scheduled Job ` - Run a job once, on a specific time (can be immediate).
55
- * ` Repeatable Job ` - Run a job multiple times (limited number of times or infinite times) based on an interval
56
- * ` Cron Job ` - Run a job multiple times (limited number of times or infinite times) based on a cron string
54
+ * ` Scheduled Task ` - Run a job once, on a specific time (can be immediate).
55
+ * ` Repeatable Task ` - Run a job multiple times (limited number of times or infinite times) based on an interval
56
+ * ` Cron Task ` - Run a job multiple times (limited number of times or infinite times) based on a cron string
57
57
58
- Scheduled jobs are scheduled when the django application starts, and after a scheduled job is executed.
58
+ Scheduled jobs are scheduled when the django application starts, and after a scheduled task is executed.
59
59
60
60
## Scheduler sequence diagram
61
61
@@ -65,12 +65,22 @@ sequenceDiagram
65
65
box Worker
66
66
participant scheduler as Scheduler Process
67
67
end
68
+ box DB
69
+ participant db as Database
70
+
71
+ end
68
72
box Redis queue
69
73
participant queue as Queue
70
- participant schedule as Queue scheduled jobs
74
+ participant schedule as Queue scheduled tasks
71
75
end
72
76
loop Scheduler process - loop forever
73
- scheduler ->> schedule: check whether there are jobs that should be scheduled for execution
77
+ note over scheduler,schedule: Database interaction
78
+ scheduler ->> db: Check for enabled tasks that should be scheduled
79
+ critical There are tasks to be scheduled
80
+ scheduler ->> schedule: Create a job for task that should be scheduled
81
+ end
82
+ note over scheduler,schedule: Redis queues interaction
83
+ scheduler ->> schedule: check whether there are scheduled tasks that should be executed
74
84
critical there are jobs that are scheduled to be executed
75
85
scheduler ->> schedule: remove jobs to be scheduled
76
86
scheduler ->> queue: enqueue jobs to be executed
0 commit comments