Set task timeout (jobs)

By default, each task runs for a maximum of 10 minutes: you can change this to a shorter time or a longer time up to 1 hour, by changing the task timeout setting as described in this page. There is no explicit timeout on a job execution: when all tasks are done, the job execution is done.

In the case of retries, the timeout setting applies to each attempt of a task. If the task attempt does not complete within this time, it will be stopped.

The units specify a duration; for example, 10m5s is ten minutes and five seconds. If you don't specify a unit, seconds are assumed as the unit. For example, the value 10 is 10 seconds.

To specify task timeout:

  1. For a job you are creating:

    gcloud beta run jobs create JOB_NAME --image IMAGE_URL --task-timeout TIMEOUT

    Replace

    • JOB_NAME with the name of your job.
    • IMAGE_URL with a reference to the container image, for example, us-docker.pkg.dev/cloudrun/container/job:latest.
    • TIMEOUT with the maximum duration for the job tasks, specifying the amount of time and the units: for example, 10m5s is ten minutes and five seconds.
  2. For a job you are updating:

    gcloud beta run jobs update JOB_NAME --task-timeout TIMEOUT

View task timeout settings

To view the current task timeout settings for your Cloud Run job:

Command line

  1. Use the following command:

    gcloud beta run jobs describe JOB_NAME
  2. Locate the task timeout setting in the returned configuration.