Manage job executions

This page describes how to view and delete job executions. To execute, cancel, or override a job configuration, 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 job executions in your project

You can view a list of the job executions in your project using Google Cloud console or Google Cloud CLI:

Console

To view the list of executions for a job:

  1. Go to the Cloud Run jobs page

  2. In the list, locate the job whose executions you want to manage.

  3. Click the job to display the executions list.

  4. In the execution details page, select the execution you are interested in from the list. You can optionally use the filter set to a desired criteria, for example, Status with a value of completed:

gcloud

To list all of the job executions for all jobs in your project:

gcloud run jobs executions list

To list only the executions for a specific job:

gcloud run jobs executions list --job JOB_NAME

Replace JOB_NAME with the name of the job you are filtering on.

For other ways to refine the returned list, including the use of filters, see jobs executions list.

To get the name of the latest execution for a specific job, use the --format flag:

gcloud run jobs describe JOB_NAME --format="value(status.latestCreatedExecution.name)"

Replace JOB_NAME with the name of the job you are filtering on.

Client libraries

To list all of the job executions from code:

REST API

To list job executions, 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-NAME/executions

Replace:

  • ACCESS_TOKEN with a valid access token for an account that has the IAM permissions to view job executions. For example, if you are logged into gcloud, you can retrieve an access token using gcloud auth print-access-token. From within a Cloud Run container instance, you can retrieve an access token using the container instance metadata server.
  • JOB-NAME with the name of the job.
  • REGION with the Google Cloud region of the job.
  • PROJECT-ID with the Google Cloud project ID.

View job execution details

You can view job execution details for the most recent 10,000 executions of a job using the execution details pane, along with any executions that occurred within the last seven days. Older execution details are removed and are no longer visible in the execution details pane. However, the logs and monitoring data for older executions are still available in Cloud Logging and Cloud Monitoring, subject to the retention policies for those products.

You can use the Google Cloud console or Google Cloud CLI to see more details about a job execution.

Console

To view details for a specific job execution:

  1. Go to the Cloud Run jobs page

  2. Click the job to open the job details pane.

  3. Click the job execution you want to view. The execution details are shown in the right hand panel.

  4. Note the Tasks, Containers, Volumes, Networking, Security, and YAML, tabs, and also the View Logs link.

    • Tasks shows information about the tasks in the job execution.
    • YAML shows the configuration of the job in YAML format.
    • Click the View Logs link to see the logs related to the execution.
    • The other tabs show information about the job, container, security, connectivity and so forth used in the execution.

gcloud

To view details about a job execution:

Use the command:

gcloud run jobs executions describe EXECUTION_NAME

Replace EXECUTION_NAME with the name of the execution.

You can use the --format flag to format the output and to get additional information. For example as YAML:

gcloud run jobs executions describe EXECUTION_NAME --format yaml

Client libraries

To view job execution details from code:

REST API

To view job execution details, 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-NAME/executions/EXECUTION-NAME

Replace:

  • ACCESS_TOKEN with a valid access token for an account that has the IAM permissions to view job execution details. For example, if you are logged into gcloud, you can retrieve an access token using gcloud auth print-access-token. From within a Cloud Run container instance, you can retrieve an access token using the container instance metadata server.
  • JOB-NAME with the name of the job.
  • EXECUTION-NAME with the name of the job execution.
  • REGION with the Google Cloud region of the job.
  • PROJECT-ID with the Google Cloud project ID.

Delete a job execution

You can delete a job execution, even during an execution. If you delete an execution, it stops the execution from continuing.

Although a deleted execution does not appear in the list of executions, 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

To delete a job execution:

  1. Go to the Cloud Run jobs page

  2. Click the job to open the job details pane.

  3. Select the job execution you want to delete.

  4. Under the Actions menu, click the ellipsis icon, then click Delete.

  5. If prompted to confirm the deletion, click Confirm.

gcloud

To delete a job execution:

  1. Use the command:

    gcloud run jobs executions delete EXECUTION_NAME

    Replace EXECUTION_NAME with the name of the execution.

  2. If prompted to confirm, respond y. Upon success, a success message will be displayed.

Client libraries

To delete a job execution from code:

REST API

To delete a job execution, send a DELETE HTTP request to 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-NAME/executions/EXECUTION-NAME

Replace:

  • ACCESS_TOKEN with a valid access token for an account that has the IAM permissions to delete job executions. For example, if you are logged into gcloud, you can retrieve an access token using gcloud auth print-access-token. From within a Cloud Run container instance, you can retrieve an access token using the container instance metadata server.
  • JOB_NAME with the name of the job.
  • EXECUTION-NAME with the name of the job execution.
  • REGION with the Google Cloud region of the job.
  • PROJECT-ID with the Google Cloud project ID.