How to increase Cloud Scheduler request timeout deadline?
Asked Answered
Z

3

11

I want to migrate from App Engine Cron jobs to Cloud Scheduler, but in Cloud Scheduler the request deadline timeout is 60 seconds, not the 10 minutes that has the requests from Cron jobs.

Is there a way to configure Cloud Scheduler App Engine request's to have a deadline timeout of 10 minutes?

Zee answered 26/4, 2019 at 19:55 Comment(0)
R
13

This will set the deadline for a job to 30mins. Which is the max for HTTP targets.

gcloud beta scheduler jobs update http <job> --attempt-deadline=1800s --project <project>

The allowed duration for this deadline is: For HTTP targets, between 15 seconds and 30 minutes. For App Engine HTTP targets, between 15 seconds and 24 hours. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

Source: https://cloud.google.com/scheduler/docs/reference/rest/v1/projects.locations.jobs#Job

Rework answered 21/2, 2021 at 3:18 Comment(2)
Hi, if my jobs run over 30min, is there any workaround to avoid the 'error' shown on the cloud scheduler? (the job finished without error)Massage
For fellow travelers, you may need to increase the timeout parameters within your services, too. I.e. using Cloud Run, --timeout=<num_seconds>s and potentially in your server handler, too (e.g. uvicorn --timeout <num_seconds>.Hurlbut
C
5

According to their scheduler.v1beta1, it is possible to set that Deadline using the attemptDeadline.

The deadline for job attempts. If the request handler does not respond by this deadline then the request is cancelled and the attempt is marked as a DEADLINE_EXCEEDED failure. The failed attempt can be viewed in execution logs. Cloud Scheduler will retry the job according to the RetryConfig.

The allowed duration for this deadline is:

For HTTP targets, between 15 seconds and 30 minutes. For App Engine HTTP targets, between 15 seconds and 24 hours. For PubSub targets, this field is ignored.

https://cloud.google.com/nodejs/docs/reference/scheduler/0.3.x/google.cloud.scheduler.v1beta1#.Job

Corves answered 28/6, 2019 at 22:5 Comment(0)
S
3

When we look at Cloud Scheduler, we see that when the time is reached to fire a job the request to fire that job may fail. At this point, the request will be retried based on the configuration of that job ... see:

https://cloud.google.com/sdk/gcloud/reference/beta/scheduler/jobs/create/http

Among these settings we find:

  • --max-backoff
  • --max-doublings
  • --max-retry-attempts
  • --max-retry-duration
  • --min-backoff

It seems that if we want to keep trying for a solid 10 minutes we might be able to specify:

  • --max-backoff: 0s
  • --max-doublings: 0
  • --max-retry-attempts: 0
  • --max-retry-duration: 10m
  • --min-backoff: 0s
Smalt answered 26/4, 2019 at 20:51 Comment(1)
This did not work for me, stil got random timeouts. When added --attempt-deadline=10m it worked!Agnesagnese

© 2022 - 2024 — McMap. All rights reserved.