简体   繁体   English

云调度器超时

[英]Cloud Scheduler Timeout

Python code in my Cloud Function (2nd generation) runs for 45minutes. Python 我的云 Function(第 2 代)中的代码运行了 45 分钟。 Cloud Scheduler job triggers this CF. Cloud Scheduler 作业触发此 CF。 Code completes successfully but Cloud Scheduler job fails as the runtime is beyond 30min.代码成功完成,但 Cloud Scheduler 作业失败,因为运行时间超过 30 分钟。 Any solution or workaround for this error?此错误的任何解决方案或解决方法?

I tried using eventarc trigger for cloud function but the timeout is 9 minutes and the code stops running after 9 minutes without throwing any error on the Cloud Scheduler job.我尝试对云 function 使用 eventarc 触发器,但超时为 9 分钟,代码在 9 分钟后停止运行,而不会在 Cloud Scheduler 作业上引发任何错误。 HTTPs trigger works well for my code but the scheduler job throws an error in the end. HTTPs 触发器适用于我的代码,但调度程序作业最终会引发错误。

All the serverless products, including Cloud Task (with HTTP, not App Engine endpoint) have a maximum of 30 minutes time out by waiting a HTTP response.所有无服务器产品,包括 Cloud Task(具有 HTTP,而不是 App Engine 端点),通过等待 HTTP 响应最多有 30 分钟的超时时间。 It should be something by default on the Google (Cloud?) infrastructure.它应该是谷歌(云?)基础设施上的默认设置。

So, you can't use ONLY Cloud Scheduler.因此,您不能仅使用 Cloud Scheduler。 My preferred pattern for that is to use Cloud Run Jobs + Cloud Workflows trigger by Cloud Scheduler.我的首选模式是使用由 Cloud Scheduler 触发的 Cloud Run Jobs + Cloud Workflows。

  • The scheduler trigger the Workflows (the correct invocation of Cloud Workflows ACKs the scheduler)调度程序触发工作流(云工作流的正确调用确认调度程序)
  • The workflows start the Cloud Run Jobs async工作流启动 Cloud Run Jobs 异步
  • The workflows poll regularly the Cloud Run jobs status工作流定期轮询 Cloud Run 作业状态
  • Handle the jobs status in the workflows (retry on error, alerts, do nothing,...)处理工作流中的作业状态(错误重试、警报、什么都不做……)

Or, you can simply ignore the Cloud Scheduler timeout and rely on monitoring/logging to track the errors或者,您可以简单地忽略 Cloud Scheduler 超时并依靠监视/日志记录来跟踪错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM