How to run long cron jobs on App Engine flexible environment?

点点圈 提交于 2019-12-22 17:58:06

问题


I have an app on App Engine (flexible environment) and configured a few cron jobs. These jobs should take several minutes but I see them failing after ~30 seconds (502 error). The documentation is not very clear regarding the max time of cron jobs (Scheduling Jobs with cron.yaml), although it seems that "An HTTP request invoked by cron can run for up to 24 hours".

Any ideas of how to overcome this? Thanks in advance


回答1:


This is an answer to my own question.

The problem I had was that I only had one Gunicorn worker. The App Engine health checks were happening every 30 seconds and there was no worker able to reply to the health checks, so the server was restarted.

I should have added more workers in the app.yaml file. For example, I've added the following line.

entrypoint: gunicorn -b :$PORT main:app --workers 12

Hope this helps.



来源:https://stackoverflow.com/questions/37431806/how-to-run-long-cron-jobs-on-app-engine-flexible-environment

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