[英]How to run long cron jobs on App Engine flexible environment?
I have an app on App Engine (flexible environment) and configured a few cron jobs. 我在App Engine(灵活的环境)上有一个应用程序,并配置了一些cron作业。 These jobs should take several minutes but I see them failing after ~30 seconds (502 error).
这些作业应花费几分钟,但我看到它们在约30秒后失败(502错误)。 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".
关于cron作业的最大时间( 使用cron.yaml调度作业 ),尽管看起来“由cron调用的HTTP请求最多可以运行24小时”,但该文档不是很清楚。
Any ideas of how to overcome this? 关于如何克服这一点的任何想法? Thanks in advance
提前致谢
This is an answer to my own question. 这是我自己的问题的答案。
The problem I had was that I only had one Gunicorn worker. 我的问题是我只有一名Gunicorn工人。 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.
App Engine运行状况检查每30秒进行一次,没有工作人员能够回复运行状况检查,因此服务器已重新启动。
I should have added more workers in the app.yaml file. 我应该在app.yaml文件中添加更多工人。 For example, I've added the following line.
例如,我添加了以下行。
entrypoint: gunicorn -b :$PORT main:app --workers 12
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.