10

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?

Kolban
  • 13,794
  • 3
  • 38
  • 60
Rony Bichler
  • 361
  • 1
  • 3
  • 8

3 Answers3

10

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

mattes
  • 8,936
  • 5
  • 48
  • 73
  • 3
    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) – han shih Dec 05 '22 at 02:35
  • For fellow travelers, you may need to increase the timeout parameters within your services, too. I.e. using Cloud Run, `--timeout=s` and potentially in your server handler, too (e.g. `uvicorn --timeout `. – Jason R Stevens CFA May 18 '23 at 00:45
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

Community
  • 1
  • 1
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
Kolban
  • 13,794
  • 3
  • 38
  • 60