Ad

Limit Two Jobs To Run In Parrallel In Apscheduler

- 1 answer

Is there a way which i can use to limit the two jobs to run in parallel in apscheduler? Basically i don't want the two jobs to be running at the same time. Is this supported by apscheduler natively ?

Ad

Answer

Just set the ThreadPoolExecutor to 1 max worker :

executors = {
    'default': ThreadPoolExecutor(1)
}

And apply it to your Scheduler, example for BackgroundScheduler:

scheduler = BackgroundScheduler(jobstores=jobstores, executors=executors, job_defaults=job_defaults, timezone=utc)

source: https://apscheduler.readthedocs.io/en/3.x/userguide.html#configuring-the-scheduler

Ad
source: stackoverflow.com
Ad