Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 830
S V Avatar asked Nov 27 '25 04:11

S V


1 Answers

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

like image 66
guillaume blaquiere Avatar answered Nov 30 '25 00:11

guillaume blaquiere



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!