2

I created a CloudRun container that has a request timeout of 900 seconds. It's triggered by CloudScheduler cron job that is also suppose to have a timeout of 900 seconds (using "--timeout 900") but after 300s (default timeout) I get a 504 timeout error and my container throttles down.

I followed this answer: How to increase Cloud Scheduler request timeout deadline? but it doesn't seem to work in the non-beta Cloud Scheduler.

Amir Mehler
  • 4,140
  • 3
  • 27
  • 36
  • Howdy Amir ... I sense that Cloud Scheduler sends a REST request to Cloud Run. I sense that you are saying that you have configured the Cloud Scheduler to expect a response within 900 seconds from Cloud Run. Can you elaborate on what you mean by "Created a CloudRun container that has a request timeout of 900 seconds". – Kolban Dec 29 '19 at 17:46
  • Thanks @Kolban! All correct, I meant to say that my CloudRun code completes its run within 900 seconds, and only then replies to the REST request. I now understand it's not a good practice here. I'll try to change it to work in shorter cycles. – Amir Mehler Dec 30 '19 at 07:52

1 Answers1

4

The attempt-deadline param is no longer in beta and you can set it up to 30 minutes for HTTP call. By the way, it can cover the 900s (15 minutes) of max Cloud Run duration.

EDIT

Your case was interesting and I contributed to the terraform Google Cloud Project. The merge request has been accepted but the terraform isn't up to date yet.

you can find details here with examples

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
  • Looks like what I need, but I can't find it implemented in terraform at the moment, I'll just go with the default timeout and shorten my jobs. – Amir Mehler Dec 30 '19 at 08:14
  • Could you please elaborate a bit on your whole workflow. Maybe it will be helpful. – Andrei Tigau Dec 30 '19 at 09:53
  • @AmirMehler, you didn't talked about terraform before! And Yes, I looked to the documentation and to the code source, it's not possible to set this param for now. – guillaume blaquiere Dec 30 '19 at 12:32
  • Thanks Y'all - I don't want to elaborate on my use case here because it's clearly not a good practice for CloudRun and CloudScheduler. My case requires a constantly running service with a long living job, not short HTTP requests which are the real target CloudRun was made for. Anyway, I'll update the header of my question which should have been only "problem with Cloud Scheduler timeouts", it has nothing to do with CloudRun. – Amir Mehler Dec 30 '19 at 14:21
  • Just to be sure to understand. You want to trigger a first endpoint for performing a long job running, and then, trigger another endpoint for keeping the instance up and continuing the process of your first request (long running job)? – guillaume blaquiere Dec 30 '19 at 19:00
  • @AmirMehler, I updated my answer. You should have now the `attempt_deadline` param in the GCP terraform provider. – guillaume blaquiere Jan 21 '20 at 08:53