APScheduler
From the beginning to the end of reading the source code, I have spent , Here is another directory for reading , Even if it is truly complete ~
Advanced Python Scheduler(APScheduler)
yes python
The next super powerful timed task framework , The overall use is not difficult , It is worth learning and using
This article is my own study APScheduler
In the process , I made a reading guide for all my notes , This includes instructions for use , Commonly used API Sort it out , And read the source code of all its core modules
A point that must be emphasized , All my source code parsing is based on APScheduler
Of 3.6.3
edition
reminder : The title of this article can jump directly to specific articles ~
This article mainly translates official about APScheduler
Introduction to entry level , What functions are provided , What requirements can be realized, etc
I also gave some examples that are more convenient to read , Easy and fast use of this library
This article mainly summarizes APScheduler
Some key common functions provided by each module API
More complete API Arrangement , You can see Official documents
analysis APScheduler
actuator executor
Source code , Start with the simplest
analysis APScheduler
Mission job
Source code
Job
The core part should be modified _modify()
function , And the serialization and deserialization part of the code
It mainly introduces the base class BaseJobStore
as well as 2 A more characteristic subclass MemoryJobStore
as well as RedisJobStore
You can find JobStore
The core is how to maintain a job.next_run_time
An ordered list of standard sizes and how to save all tasks for easy retrieval ~
The basic class is introduced in detail BaseTrigger
And execute once at a fixed time DateTrigger
And running tasks at regular intervals IntervalTrigger
, The overall code is not difficult ~
This article is mainly for CronTrigger
Trigger paving , Sort out the implementation of all regular expression matching classes
In detail CronTrigger
The implementation of the , Customized settings are made for each field of time , The idea of implementation is still worth understanding ~
Analysis of the OrTrigger
and AndTrigger
this 2 A composite trigger , Accidentally found some design problems bug
, Finally, the following 2 A suggestion :
OrTrigger
Multiple... Are set at the same time in DateTrigger
When !AndTrigger
! Of course, the above advice is based on 3.6.3
Version of , 4.0
Version bosses are developing , Look forward to their realization ideas
Base class for scheduling all modules BaseScheduler
And one of its subclasses BlockingScheduler
Source code analysis
It is the first series that I have finished , You can't praise me too much ~