기본적으로 각 태스크는 최대 10분 동안 실행됩니다. 이 시간은 더 짧게 변경할 수도 있고 최대 168시간(7일)까지 더 긴 시간으로 변경할 수도 있습니다. 미리보기에서는 24시간이 넘는 제한 시간이 지원됩니다.
이 페이지에 설명된 대로 태스크 제한 시간을 설정합니다. 작업 실행에는 명시적인 제한 시간이 없습니다. 모든 태스크가 완료되면 작업 실행이 완료된 것입니다.
단위로 기간을 지정합니다. 초, 분, 시간을 나타내는 정수 값으로 제한 시간 기간을 지정할 수 있습니다. 예를 들어 제한 시간 기간을 10분 5초로 설정하려면 값을 605초로 지정합니다.
작업에 재시도가 사용 설정된 경우 제한 시간 설정이 태스크의 각 시도에 적용됩니다.
이 시간 내에 태스크 시도가 완료되지 않으면 중지됩니다. 작업이 실행되는 시간이 길어질수록 다운스트림 종속 항목 실패, 메모리 부족 오류, 인프라 문제와 같이 작업 실패를 야기하는 문제가 발생할 가능성이 높습니다. 모든 작업에 재시도를 사용 설정하는 것이 좋으며, 특히 장기 실행 태스크가 있는 작업의 경우 더욱 그렇습니다.
유지보수 이벤트
작업은 주기적으로 유지보수 이벤트를 거칩니다. 유지보수 이벤트 중에는 진행 중인 태스크가 현재 머신에서 다른 머신으로 마이그레이션됩니다.
태스크가 마이그레이션되는 동안 처리가 잠시 중단됩니다.
마이그레이션 프로세스는 태스크 상태를 보존하지만 한 가지 주목할 만한 예외가 있습니다. 유지보수 이벤트 중에 아웃바운드 VPC 네트워크 연결이 끊어집니다.
비정기적인 연결 재설정을 처리할 수 있는 클라이언트 라이브러리를 사용하는 것이 좋습니다.
Cloud Run은 태스크가 마이그레이션을 시작하고 완료할 때마다 로그 메시지를 출력합니다.
또한 특정 방식으로 유지보수 이벤트를 모니터링하거나 처리하려면 태스크가 마이그레이션되기 10초 전에 전송되는 SIGTSTP 신호를 포착할 수 있습니다. 마이그레이션 후에는 태스크가 다시 시작되고 나서 즉시 SIGCONT 신호가 태스크에 수신됩니다.
메뉴에서 작업을 선택하고 컨테이너 배포를 클릭하여 초기 작업 설정 페이지를 작성합니다. 기존 작업을 구성하는 경우 작업을 선택한 후 수정을 클릭합니다.
컨테이너, 볼륨, 연결, 보안을 클릭하여 작업 속성 페이지를 펼칩니다.
일반 탭을 클릭합니다.
태스크 제한 시간 필드에 현재 작업에 포함된 작업 태스크의 최대 기간을 지정하고 시간 단위를 선택합니다. 제한 시간 기간은 초, 분, 시간의 정수 값으로만 지정할 수 있습니다. 예를 들어 기간을 10분 5초로 설정하려면 태스크 제한 시간 필드에서 605를 지정하고 시간 단위로 초를 선택합니다.
resource"google_cloud_run_v2_job""default"{name="cloud-run-job-timeout"location="us-central1"deletion_protection=false # set to "true" in productiontemplate{template{timeout="3.500s"containers{image="us-docker.pkg.dev/cloudrun/container/job:latest"}}}}
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-15(UTC)"],[],[],null,["# Set task timeout for jobs\n\nBy default, each task runs for a maximum of 10 minutes:\nyou can change this to a shorter time or a longer time up to\n168 hours (7 days). Support for timeouts greater than\n24 hours is available in [Preview](/products#product-launch-stages).\n\nYou set task timeout as described in this page. There is no explicit timeout\non a job execution: when all tasks are done, the job execution is done.\n\nThe units specify a duration. You can specify the timeout duration as an integer\nvalue in seconds, minutes, or hours. For example, to set the timeout duration as\n10 minutes and 5 seconds, specify the value as `605` seconds.\n\nIf your job has retries enabled, the timeout setting applies to each attempt of a task.\nIf the task attempt does not complete within this time, it will be\nstopped. The longer a job runs, the more likely it is to run into issues that\ncause it to fail, such as downstream dependency failures, out of memory errors,\nor infrastructure issues. We recommend enabling retries for all jobs, but\nespecially for jobs with long-running tasks.\n\n### Maintenance events\n\nJobs periodically undergo maintenance events. During a maintenance event, any\nin-progress tasks are migrated from the current machine to a different machine.\nThere is a brief pause in processing while the task is migrated.\n\nThe migration process preserves the state of the task, with one notable\nexception: outbound VPC network connections break during maintenance events.\nWe recommend that you use client libraries that can handle occasional connection\nresets.\n\nCloud Run prints out a log message every time a task starts and\nfinishes migrating.\n\nAdditionally, if you want to monitor or handle maintenance events in a specific way,\nyou can catch the `SIGTSTP` signal, which is sent 10 seconds before a task is\nmigrated. After migration, the task receives a `SIGCONT` signal immediately\nafter the task is restarted.\n\nThe following Go sample is a function that catches these signals and prints out\na log entry: \n\n```go\nfunc testSignals() {\n sigs := make(chan os.Signal, 1)\n signal.Notify(sigs, syscall.SIGTSTP, syscall.SIGCONT)\n go func() {\n for {\n sig := \u003c-sigs\n log.Printf(\"Got Signal: %v\", sig)\n }\n }()\n }\n \n```\n\nRequired roles\n--------------\n\n\nTo get the permissions that\nyou need to configure Cloud Run jobs,\n\nask your administrator to grant you the\nfollowing IAM roles:\n\n- [Cloud Run Developer](/iam/docs/roles-permissions/run#run.developer) (`roles/run.developer`) on the Cloud Run job\n- [Service Account User](/iam/docs/roles-permissions/iam#iam.serviceAccountUser) (`roles/iam.serviceAccountUser`) on the service identity\n\n\nFor a list of IAM roles and permissions that are associated with\nCloud Run, see\n[Cloud Run IAM roles](/run/docs/reference/iam/roles)\nand [Cloud Run IAM permissions](/run/docs/reference/iam/permissions).\nIf your Cloud Run job interfaces with\nGoogle Cloud APIs, such as Cloud Client Libraries, see the\n[service identity configuration guide](/run/docs/configuring/jobs/service-identity).\nFor more information about granting roles, see\n[deployment permissions](/run/docs/reference/iam/roles#additional-configuration)\nand [manage access](/iam/docs/granting-changing-revoking-access).\n\nSet task timeout\n----------------\n\nTo specify task timeout for a Cloud Run job: \n\n### Console\n\n\n1. In the Google Cloud console, go to the Cloud Run jobs page:\n\n [Go to Cloud Run](https://console.cloud.google.com/run)\n2. Select **Jobs** from the menu, and click **Deploy container** to fill out\n the initial job settings page. If you are configuring an existing job,\n select the job, then click **Edit**.\n\n3. Click **Container(s), Volumes, Connections, Security** to expand the job properties page.\n\n4. Click the **General** tab.\n\n - In the **Task timeout** field, specify the maximum duration for the job tasks in the current job, and select a **Time unit** . You can only specify the timeout duration as an integer value in **second** , **minute** , or **hour** . For example, to set a duration of 10 minutes and 5 seconds, in the **Task timeout** field, specify `605`, and select the **Time unit** as **second**.\n5. Click **Create** or **Update**.\n\n### gcloud\n\n1. For a job you are creating:\n\n ```bash\n gcloud run jobs create JOB_NAME --image IMAGE_URL --task-timeout TIMEOUT\n ```\n\n Replace\n - \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e with the name of your job.\n - \u003cvar translate=\"no\"\u003eIMAGE_URL\u003c/var\u003e: a reference to the [container image](/run/docs/building/containers)---for example, `us-docker.pkg.dev/cloudrun/container/job:latest`.\n - \u003cvar translate=\"no\"\u003eTIMEOUT\u003c/var\u003e 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.\n2. For a job you are updating:\n\n ```bash\n gcloud run jobs update JOB_NAME --task-timeout TIMEOUT\n ```\n\n### YAML\n\n1. If you are creating a new job, skip this step.\n If you are updating an existing job, download its [YAML configuration](/run/docs/reference/yaml/v1#job):\n\n ```bash\n gcloud run jobs describe JOB_NAME --format export \u003e job.yaml\n ```\n2. Update the `timeoutSeconds:` attribute:\n\n ```yaml\n apiVersion: run.googleapis.com/v1\n kind: Job\n metadata:\n name: JOB\n spec:\n template:\n spec:\n template:\n spec:\n containers:\n - image: IMAGE\n timeoutSeconds: TIMEOUT\n ```\n\n Replace:\n - \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e with the name of your job.\n - \u003cvar translate=\"no\"\u003eIMAGE_URL\u003c/var\u003e: a reference to the [container image](/run/docs/building/containers)---for example, `us-docker.pkg.dev/cloudrun/container/job:latest`.\n - \u003cvar translate=\"no\"\u003eTIMEOUT\u003c/var\u003e with the maximum duration for the job tasks, specifying the amount of time and the units. You can only specify time as an integer value in seconds, minutes, or hours. For example, to set a duration of 10 minutes and 5 seconds, specify `605`.\n\n You can also specify more configuration details, such as environment variables or\n memory limits.\n3. Update the existing job configuration:\n\n ```bash\n gcloud run jobs replace job.yaml\n ```\n\n### Terraform\n\n\u003cbr /\u003e\n\nTo learn how to apply or remove a Terraform configuration, see\n[Basic Terraform commands](/docs/terraform/basic-commands).\nAdd the following to a [`google_cloud_run_v2_job`](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_v2_job) resource in your Terraform configuration: \n\n\u003cbr /\u003e\n\n resource \"google_cloud_run_v2_job\" \"default\" {\n name = \"cloud-run-job-timeout\"\n location = \"us-central1\"\n\n deletion_protection = false # set to \"true\" in production\n\n template {\n template {\n timeout = \"3.500s\"\n\n containers {\n image = \"us-docker.pkg.dev/cloudrun/container/job:latest\"\n }\n }\n }\n }\n\nView task timeout settings\n--------------------------\n\nTo view the current task timeout settings for your\nCloud Run job: \n\n### Console\n\n1. In the Google Cloud console, go to the Cloud Run jobs page:\n\n [Go to Cloud Run jobs](https://console.cloud.google.com/run/jobs)\n2. Click the job you are interested in to open the **Job details** page.\n\n3. Click **View and Edit job configuration**.\n\n4. Locate the task timeout setting in the configuration\n details.\n\n### gcloud\n\n1. Use the following command:\n\n ```bash\n gcloud run jobs describe JOB_NAME\n ```\n2. Locate the task timeout setting in the returned\n configuration."]]