The example as shown below is obtained from in https://apscheduler.readthedocs.io/en/stable/userguide.html#configuring-the-scheduler. It demonstrates how to configure a scheduler. But I do not understand what exactly the config is doing.
Question
jobstores
has two keys, one using MongoDB, and the other is SQLite. So which one will the scheduler use?executors
has two keys as well, one using ThreadPoolExecutor and the other is ProcessPoolExecutor. Which one would it use? And what is being parallelise (e.g. all the scheduled jobs) ?
from pytz import utc
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.jobstores.mongodb import MongoDBJobStore
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
jobstores = {
'mongo': MongoDBJobStore(),
'default': SQLAlchemyJobStore(url='sqlite:///jobs.sqlite')
}
executors = {
'default': ThreadPoolExecutor(20),
'processpool': ProcessPoolExecutor(5)
}
job_defaults = {
'coalesce': False,
'max_instances': 3
}
scheduler = BackgroundScheduler(jobstores=jobstores, executors=executors, job_defaults=job_defaults, timezone=utc)