简体   繁体   English

如何在App Engine灵活环境中运行长时间的cron作业?

[英]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.

相关问题 无法在本地主机上运行App Engine的Cron作业 - Cannot run Cron Jobs of App Engine in localhost Google App Engine Flexible环境中的Cron作业失败 - Cron job failed in Google App Engine Flexible environment 如何在Google App Engine上调试Cron Jobs? - How to debug Cron Jobs on Google App Engine? 如何在App Engine中安排Cron作业? - How to schedule cron jobs in app engine? App Engine弹性环境如何运作? - How does app engine flexible environment works? 在Google App Engine的暂存环境中处理Cron作业 - Handling cron jobs on staging environment on google app engine 您如何在同一个 Google App Engine 项目中同时运行灵活环境和标准环境? - How do you run both Flexible Environment and Standard Environment in the same Google App Engine project? 将Google App Engine应用程序升级到灵活环境时,如何运行Google的aefix工具? - How do I run Google's aefix tool when upgrading a Google App Engine app to the flexible environment? 是否可以在Google App Engine ** Flexible **环境中运行Windows可执行文件? - Is it possible to run a Windows executable in Google App Engine **Flexible** environment? Cron作业是否同时在Google App Engine中运行? - Do cron jobs run simultaneously in google app engine?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM