I am using APScheduler to run a python method in every 5 minutes. It's working perfectly. I need to limit the scheduled job iteration to 100. After the 100 iteration it should close the process. I have checked the reference document but I am unable to find any option which provide this feature. We have option to control number of job instance but not the max iteration. Does anyone has idea about that?
from apscheduler.schedulers.blocking import BlockingScheduler
def job():
print "Decorated job"
scheduler = BlockingScheduler()
scheduler.add_job(job, 'interval', minutes=5)
scheduler.start()
OR if I get the scheduled job iteration count then I can also remove the running job from code itself like below.
scheduler = BlockingScheduler()
scheduler.add_job(job, 'interval', minutes=5, id='my_job_id')
#iterationCount ??
if (iterationCount = 100 ):
scheduler.remove_job('my_job_id')
exit(0)
scheduler.start()