My main script looks like this:
if __name__ == "__main__":
scheduler = BlockingScheduler()
scheduler.add_job(job_x,'cron',id="job_x",day_of_week="tue", hour=11, minute=49,
jobstore="default")
scheduler.add_listener(my_listener,EVENT_JOB_EXECUTED | EVENT_JOB_ERROR)
try:
scheduler.start()
except (KeyboardInterrupt, SystemExit):
print("Exception Caught")
Is there a way to check whether the job 'job_x' is taking more than 1 week to run, and if so, to stop it?
I was also wondering if background scheduler wouldn't be a better option.