This page describes how to manage jobs. To create a job, see create jobs. To execute a job, see Execute jobs.
Required roles
To get the permissions that
you need to manage Cloud Run jobs,
ask your administrator to grant you the
Cloud Run Developer (roles/run.developer) IAM role on your Cloud Run job.
For a list of IAM roles and permissions that are associated with Cloud Run, see Cloud Run IAM roles and Cloud Run IAM permissions. If your Cloud Run job interfaces with Google Cloud APIs, such as Cloud Client Libraries, see the service identity configuration guide. For more information about granting roles, see deployment permissions and manage access.
View jobs in your project
You can view a list of the jobs in your project using the Google Cloud console, the gcloud CLI, client libraries, or the REST API:
Console
In the Google Cloud console, go to the Cloud Run jobs page:
Optional: Filter the job by one of the criteria in the menu, such as job name, execution time, or region.
gcloud
To list all jobs in your project, run the following command:
gcloud run jobs list
To filter jobs by region, run the following command:
gcloud run jobs list --region REGION
Replace REGION with the name of the region you
want to filter—for example europe-west1.
For other ways to refine the returned list, including the use of filters, see jobs list.
Client libraries
To view jobs in your project from code:
REST API
To view the list of jobs in your project, send a GET HTTP request to
the Cloud Run Admin API jobs endpoint.
For example, using curl:
curl -H "Content-Type: application/json" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -X GET \ -d '' \ https://run.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/jobs
Replace the following:
ACCESS_TOKEN: a valid access token for an account that has the IAM permissions to view jobs. For example, if you are logged into gcloud, you can retrieve an access token usinggcloud auth print-access-token. From within a Cloud Run container instance, you can retrieve an access token using the container instance metadata server.PROJECT_ID: the Google Cloud project ID.REGION: the Google Cloud region of the job.
View job details
You can view more details about a job using the Google Cloud console, the gcloud CLI, client libraries, or the REST API:
Console
In the Google Cloud console, go to the Cloud Run jobs page:
Locate the job you are interested in.
Click the job to display the job details page.
Navigate between the History, Logs, Metrics, and YAML tabs:
- History shows information about the tasks in the job execution.
- Logs shows the logs information.
- Metrics shows information about the job executions.
- YAML shows the configuration of the job in YAML format.
gcloud
To view details about a job, run the following command:
gcloud run jobs describe JOB
Replace JOB with the name of the job.
Client libraries
To view details about a job from code:
REST API
To view details about a job, send a GET HTTP request to
the Cloud Run Admin API jobs endpoint.
For example, using curl:
curl -H "Content-Type: application/json" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -X GET \ -d '' \ https://run.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/jobs/JOB
Replace the following:
ACCESS_TOKEN: a valid access token for an account that has the IAM permissions to view job details. For example, if you are logged into gcloud, you can retrieve an access token usinggcloud auth print-access-token. From within a Cloud Run container instance, you can retrieve an access token using the container instance metadata server.PROJECT_ID: the Google Cloud project ID.REGION: the Google Cloud region of the job.JOB: the name of your Cloud Run job.
Delete a job
Deleting a job terminates all the job executions in progress and all running container instances.
Although a deleted job no longer appears in the list of jobs, its logs continue to be available in Cloud Logging for the remainder of the log retention period, and monitoring data continues to be available in Cloud Monitoring.
Console
In the Google Cloud console, go to the Cloud Run jobs page:
Select the job.
Click Delete.
Click Confirm
gcloud
To delete a job, run the following command:
gcloud run jobs delete JOB
Replace JOB with the name of the job.
If prompted to confirm, respond y. Upon completion, a success message
will be displayed.
Client libraries
To delete a job from code:
REST API
To delete a job, send a DELETE HTTP request to
the Cloud Run Admin API jobs endpoint.
For example, using curl:
curl -H "Content-Type: application/json" \ -H "Authorization: Bearer ACCESS_TOKEN" \ -X DELETE \ -d '' \ https://run.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/jobs/JOB
Replace the following:
ACCESS_TOKEN: a valid access token for an account that has the IAM permissions to delete jobs. For example, if you are logged into gcloud, you can retrieve an access token usinggcloud auth print-access-token. From within a Cloud Run container instance, you can retrieve an access token using the container instance metadata server.PROJECT_ID: the Google Cloud project ID.REGION: the Google Cloud region of the job.JOB: the name of your Cloud Run job.