python apscheduler - skipped: maximum number of running instances reached

It means that the task is taking longer than one second and by default only one concurrent execution is allowed for a given job. I cannot tell you how to handle this without knowing what the task is about.


I am pretty sure my task is not taking more than the interval. I just followed this answer instead and switched to apscheduler==2.1.2 as suggested here.


Increase max_instances

If the particular use case permits it, simply increase max_instances as shown below.

import apscheduler.schedulers.background

scheduler = apscheduler.schedulers.background.BackgroundScheduler({'apscheduler.job_defaults.max_instances': 2})

There are three apscheduler configuring styles. These are described in the documentation. Above is the dictionary/JSON style, here is the argument style:

import apscheduler.schedulers.background

scheduler = apscheduler.schedulers.background.BackgroundScheduler(job_defaults={'max_instances': 2})

If you want concurrently running instances of the same job and avoid the warning, you can include the max_instances argument in the scheduler's add_job() method. The default value is one.