I am trying to run a job every second after every 5 minute time mark e.g. 10:00:01,10:05:01 etc with the python code below. For the most part the jobs run on time, but in some cases after a job fails (e.g. some data missing at some time so exception is thrown) the next jobs don't run at the expected time (the next 5 minute interval + 1s) but hours later. Why might this be ?

from apscheduler.schedulers.blocking import BlockingScheduler
import myjob as jb
import sys

def job_function():
    print("running scraper")
    scp = jb.run()

sched = BlockingScheduler()

minstr = ','.join(str(i) for i in range(59) if i % 5 == 0)
sched.add_job(job_function, 'cron', minute=minstr, second = "1")


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.