WARNING:apscheduler.scheduler:Execution of job skipped: maximum number of running instances reached (1)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 13:44:26

问题


In my code i run a cron job which is run for every five seconds, and I've been getting the same WARNING ever since.

this is the api that i used:

sched.add_cron_job(test_3, second="*/5")

And I get a warning:

WARNING:apscheduler.scheduler:Execution of job "test_3 (trigger: cron[second='*/5'], next run at: 2013-11-28 15:56:30)" skipped: maximum number of running instances reached (1)

I tried giving time gap of 2 minutes it doesn't solve the issue..... Help me in overcoming this issue..


回答1:


I used the proc.terminate() to stop the execution of my method. So that the instance of the 1st thread is terminated before a new thread could start again.

Also provide a timing mechanism to complete your process well within the scheduled time say within a minute, hour or day etc. In my application i used *sleep(in_seconds)* for providing the timing mechanism.




回答2:


I had a similar problem, and it turned out it was just your job 'test_3' lasting too long, more then 5 secs (or 2 minutes as you tried). APScheduler is trying to re-execute you job, but the previous one is still running.



来源:https://stackoverflow.com/questions/20264298/warningapscheduler-schedulerexecution-of-job-skipped-maximum-number-of-runnin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!