88---
99
1010A 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.
1212
1313## Terminology
1414
@@ -17,7 +17,7 @@ This allows remembering scheduled jobs, their parameters, etc.
1717A queue of messages between processes (main django-app process and worker usually).
1818This is implemented in ` rq ` package.
1919
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.
2121
2222### Worker
2323
@@ -36,26 +36,26 @@ This is a sub-process of worker.
3636Once a worker listening to the queue becomes available,
3737the job will be executed
3838
39- ### Scheduled Job Execution
39+ ### Scheduled Task Execution
4040
4141A scheduler checking the queue periodically will check
4242whether the time the job should be executed has come, and if so, it will queue it.
4343
4444* A job is considered scheduled if it is queued to be executed, or scheduled to be executed.
4545* If there is no scheduler, the job will not be queued to run.
4646
47- ### Scheduled Job
47+ ### Scheduled Task
4848
4949django models storing information about jobs. So it is possible to schedule using
5050django-admin and track their status.
5151
52- There are 3 types of scheduled job .
52+ There are 3 types of scheduled task .
5353
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
5757
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.
5959
6060## Scheduler sequence diagram
6161
@@ -65,12 +65,22 @@ sequenceDiagram
6565 box Worker
6666 participant scheduler as Scheduler Process
6767 end
68+ box DB
69+ participant db as Database
70+
71+ end
6872 box Redis queue
6973 participant queue as Queue
70- participant schedule as Queue scheduled jobs
74+ participant schedule as Queue scheduled tasks
7175 end
7276 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
7484 critical there are jobs that are scheduled to be executed
7585 scheduler ->> schedule: remove jobs to be scheduled
7686 scheduler ->> queue: enqueue jobs to be executed
0 commit comments