2

I am building an interval based scheduler using apscheduler. Here's the code:

from flask import Flask
import time
from apscheduler.schedulers.background import BackgroundScheduler
def job1():
    print('performed job1')
def job2():
    print('performed job2')
sched = BackgroundScheduler(daemon=True)
sched.add_job(lambda : sched.print_jobs(),'interval',minutes=1)
sched.add_job(job1,'interval', minutes=1)
sched.add_job(job2, 'interval',minutes=2)
try:
    sched.start()
except (KeyboardInterrupt, SystemExit):
    pass
app = Flask(__name__)
if __name__ == "__main__":
    app.run()

whenever two jobs are triggered simultaneously, apscheduler performs the second one. I just want to know, on what basis does apscheduler decide which job to perform out of the two clashed jobs. And is it possible to change that criteria as i want to perform the job which has the higher priority.I'm defining priorities explicitly.

0 Answers0