이 페이지에서는 Batch 작업을 취소하는 방법을 설명합니다.
실행을 중지하거나 실행하지 않으려는 작업을 취소합니다.
의도한 대로 작동하지 않을 때마다 실행을 자동으로 중지하고 실패하도록 작업을 구성하는 것이 좋습니다. 예를 들어 0이 아닌 종료 코드 또는 제한 시간을 반환하도록 실행 가능 항목을 구성합니다. 하지만 실제로는 완료되지 않은 작업을 수동으로 중지해야 할 수도 있습니다. 예를 들어 문제를 해결해야 하는 경우 작업을 취소하거나 아직 완료되지 않은 작업을 교체해야 합니다.
성공 및 실패한 작업과 마찬가지로 취소된 작업은 최대 60일 동안 프로젝트에 남아 있으며 그 후에는 Google Cloud에서 자동으로 삭제됩니다. 작업을 취소하고 작업 정보를 보관할 필요가 없는 경우 즉시 작업을 삭제할 수 있습니다.
[[["이해하기 쉬움","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-09-04(UTC)"],[[["\u003cp\u003eThis page outlines the process for canceling Batch jobs, which is useful for stopping jobs that are running or preventing jobs from starting.\u003c/p\u003e\n"],["\u003cp\u003eCanceling a job can be done manually, for example, when a job requires troubleshooting, or it should be configured to automatically stop by a non-zero exit code or timeout.\u003c/p\u003e\n"],["\u003cp\u003eTo cancel a job, you need the Batch Job Editor role (\u003ccode\u003eroles/batch.jobsEditor\u003c/code\u003e) and can do so using either the \u003ccode\u003egcloud alpha batch jobs cancel\u003c/code\u003e command in the Google Cloud CLI or the \u003ccode\u003ejobs.cancel\u003c/code\u003e v1alpha method in the Batch API.\u003c/p\u003e\n"],["\u003cp\u003eCancelled jobs, similar to succeeded and failed jobs, remain in the project for 60 days before being automatically deleted by Google Cloud, but you can delete the job immediately to not keep the information if desired.\u003c/p\u003e\n"],["\u003cp\u003eBefore canceling a job, make sure to have enabled Batch and completed the prerequisites, and remember to replace placeholders like \u003ccode\u003eJOB_NAME\u003c/code\u003e and \u003ccode\u003eLOCATION\u003c/code\u003e with your specific job and location details.\u003c/p\u003e\n"]]],[],null,["# Cancel jobs\n\nThis page describes how to cancel Batch jobs.\nCancel jobs that you want to stop running or prevent from running.\n\nIdeally, you should configure your jobs to automatically stop running and\nfail whenever they don't behave as intended. For example, configure your\nrunnables to return a non-zero exit code or [timeout](/batch/docs/set-timeouts).\nBut, in practice, you might still want to manually stop unfinished\njobs. For example, cancel a job when you notice you need to troubleshoot or\nreplace a job that hasn't finished yet.\n\nLike succeeded and failed jobs, a cancelled job remains in your project for up\nto 60 days, after which Google Cloud automatically deletes the job. If you\nwant to cancel a job and don't need to retain the job's information, then you\ncan immediately [delete the job](/batch/docs/delete-job) instead.\n\nBefore you begin\n----------------\n\n1. If you haven't used Batch before, review [Get started with Batch](/batch/docs/get-started) and enable Batch by completing the [prerequisites for projects and users](/batch/docs/get-started#prerequisites).\n2.\n\n To get the permissions that\n you need to cancel a job,\n\n ask your administrator to grant you the\n\n\n [Batch Job Editor](/iam/docs/roles-permissions/batch#batch.jobsEditor) (`roles/batch.jobsEditor`)\n IAM role on the project.\n\n\n For more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\n You might also be able to get\n the required permissions through [custom\n roles](/iam/docs/creating-custom-roles) or other [predefined\n roles](/iam/docs/roles-overview#predefined).\n\n\u003cbr /\u003e\n\nCancel a job\n------------\n\nYou can cancel a job using the gcloud CLI or\nBatch API. \n\n### gcloud\n\nTo cancel a job using the gcloud CLI, use the\n[`gcloud batch jobs cancel` command](/sdk/gcloud/reference/batch/jobs/cancel): \n\n gcloud batch jobs cancel \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e: the name of the job.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the [location](/batch/docs/locations) of the job.\n\n### API\n\nTo cancel a job using the Batch API, use the\n[`jobs.cancel` method](/batch/docs/reference/rest/v1/projects.locations.jobs/cancel): \n\n POST https://batch.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e/jobs/\u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e:cancel\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the [project ID](/resource-manager/docs/creating-managing-projects#identifying_projects) of your project.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the [location](/batch/docs/locations) of the job.\n- \u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e: the name of the job.\n\nWhat's next\n-----------\n\n- Learn how to [limit run times using timeouts](/batch/docs/set-timeouts).\n- Learn about [troubleshooting](/batch/docs/troubleshooting).\n- Learn how to manage jobs:\n - [View the jobs in your project](/batch/docs/view-jobs-tasks).\n - [Export job information](/batch/docs/export-job-info).\n - [Delete jobs](/batch/docs/delete-job).\n- [Create another job](/batch/docs/create-run-job#job-creation-options)."]]