This page describes how to delete a Batch job.
Before you begin
- If you haven't used Batch before, review Get started with Batch and enable Batch by completing the prerequisites for projects and users.
-
To get the permissions that you need to delete a job, ask your administrator to grant you the Batch Job Editor (
roles/batch.jobsEditor
) IAM role on the project. For more information about granting roles, see Manage access.You might also be able to get the required permissions through custom roles or other predefined roles.
Delete a job
Delete a job when you are ready to remove it from your project's list of jobs and no longer need the job's history. If you delete a job before or while it is running, the job is canceled.
You can delete a job using the Google Cloud console, gcloud CLI, Batch API, Go, Java, Node.js, or Python.
Console
To delete a job using the Google Cloud console, do the following:
In the Google Cloud console, go to the Job list page.
Click the name of the job you created. The Job details page opens.
Click
Delete.In the Delete batch job? dialog, for the field, enter
Delete
.Click Delete.
The Job list page displays that the job is deleted.
gcloud
To delete a job using the gcloud CLI, use the
gcloud batch jobs delete
command.
gcloud batch jobs delete JOB_NAME --location LOCATION
Replace the following:
JOB_NAME
: the name of the job.LOCATION
: the location of the job.
API
To delete a job using the Batch API, use the
jobs.delete
method:
DELETE https://batch.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/jobs/JOB_NAME
Replace the following:
PROJECT_ID
: the project ID of your project.LOCATION
: the location of the job.JOB_NAME
: the name of the job.
Go
Go
For more information, see the Batch Go API reference documentation.
To authenticate to Batch, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
Java
For more information, see the Batch Java API reference documentation.
To authenticate to Batch, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
Node.js
For more information, see the Batch Node.js API reference documentation.
To authenticate to Batch, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
Python
For more information, see the Batch Python API reference documentation.
To authenticate to Batch, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
What's next
- Create another job.
- Learn more about creating jobs:
- Follow a tutorial: Run a Batch job using Workflows.
- For more Batch code samples, see GitHub.