admin管理员组文章数量:1360003
I am currently using APScheduler+fastapi to run an api that manages scheduling requests and executes them as an openshift deployment. It is great at timing my tasks, however when the pod restarts it causes many tasks that are missed to be skipped. I would like to prevent that, and make them all run when the pod comes back up instead of waiting for the next trigger. I tried pausing the scheduler on app shutdown using FastAPI's lifespan, but this doesn't do the trick. I am aware of this thread, however my tasks are async and therefore I have to use AsyncIOScheduler. In the APScheduler user guide, the following is written:
If the execution of a job is delayed due to no threads or processes being available in the pool, the executor may skip it due to it being run too late (compared to its originally designated run time). If this is likely to happen in your application, you may want to either increase the number of threads/processes in the executor, or adjust the misfire_grace_time setting to a higher value.
However, setting a high misfire_grace_time seems like a patch to me, as I want to run the jobs immediately regardless of the pod down time, given that they were missed. Is there any solution to this problem? I thought that maybe there exists a built in function for the scheduler to give me the missed jobs so I can run them manually but I haven't found one
本文标签: pythonhow to run every missed APScheduler job on process restartStack Overflow
版权声明:本文标题:python - how to run every missed APScheduler job on process restart? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743929854a2563642.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论