简体   繁体   中英

Cloud Scheduler Timeout

Python code in my Cloud Function (2nd generation) runs for 45minutes. Cloud Scheduler job triggers this CF. Code completes successfully but Cloud Scheduler job fails as the runtime is beyond 30min. 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. HTTPs trigger works well for my code but the scheduler job throws an error in the end.

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. It should be something by default on the Google (Cloud?) infrastructure.

So, you can't use ONLY Cloud Scheduler. My preferred pattern for that is to use Cloud Run Jobs + Cloud Workflows trigger by Cloud Scheduler.

  • The scheduler trigger the Workflows (the correct invocation of Cloud Workflows ACKs the scheduler)
  • The workflows start the Cloud Run Jobs async
  • The workflows poll regularly the Cloud Run jobs status
  • 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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