Cancel pipeline runs

If you no longer need a scheduled or running pipeline run, you can cancel it. If there are multiple pipeline runs to cancel, you can batch cancel those pipeline runs.

When you initiate a pipeline run cancellation, the status of the pipeline run changes to Canceling. During this status, Vertex AI Pipelines cancels all the remaining tasks in the pipeline and all the Google Cloud services and resources invoked by the pipeline run. After all of these tasks, services, and resources are canceled, the pipeline status changes to Canceled.

Note that a canceled pipeline run isn't deleted. You have the option to delete the pipeline run after you cancel it.

Cancel a pipeline run

To cancel a pipeline run, use the Google Cloud console, the REST API, or the Vertex AI SDK for Python.

Console

Use the following instructions to cancel an ongoing pipeline run from the Google Cloud console:

  1. In the Vertex AI section, go to the Runs tab on the Pipelines page.

    Go to Runs

  2. In the Run column, click the name of the pipeline run that you want to cancel.
  3. On the page displaying the pipeline run details, click Stop. This option is available only if the pipeline run is in the Running status.

After you click Stop, the status of the pipeline changes to Canceling. After all the pipeline tasks, Google Cloud services, and Google Cloud resources invoked by the run are canceled, the status changes to Canceled.

REST

To cancel an ongoing or scheduled pipeline run, send a POST request by using the pipelineJobs.cancel method.

Before using any of the request data, make the following replacements:

  • LOCATION: The region where the pipeline run is located. For more information about the regions where Vertex AI Pipelines is available, see the Vertex AI locations guide.
  • PROJECT_ID: The Google Cloud project containing the pipeline run.
  • PIPELINE_RUN_ID: The unique ID of the pipeline run that you want to cancel. The pipeline run ID is displayed in the Runs tab on the Pipelines page in the Google Cloud console.

HTTP method and URL:

POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/pipelineJobs/PIPELINE_RUN_ID:cancel

To send your request, choose one of these options:

curl

Execute the following command:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/pipelineJobs/PIPELINE_RUN_ID:cancel"

PowerShell

Execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/pipelineJobs/PIPELINE_RUN_ID:cancel" | Select-Object -Expand Content

You should receive a successful status code (2xx) and an empty response.

Python

Use the following sample to cancel an ongoing or scheduled pipeline run by using the PipelineJob.cancel method:

from google.cloud import aiplatform
aiplatform.init(project=PROJECT_ID, location=LOCATION)
pipeline_job = aiplatform.PipelineJob.get(resource_name="PIPELINE_RUN_ID")
pipeline_job.cancel()

Replace the following:

  • PROJECT_ID: The Google Cloud project containing the pipeline run.
  • LOCATION: The region where the pipeline run is located. For more information about the regions where Vertex AI Pipelines is available, see the Vertex AI locations guide.
  • PIPELINE_RUN_ID with the unique ID of the pipeline run that you want to cancel. The ID is displayed in the Runs tab on the Pipelines page in the Google Cloud console.

Cancel multiple pipeline runs

To cancel multiple pipeline runs simultaneously, use the REST API, or the Vertex AI SDK for Python. You can batch cancel pipeline runs that are in the same project and region.

REST

To batch cancel multiple ongoing or scheduled pipeline runs, send a POST request by using the pipelineJobs.batchCancel method.

Before using any of the request data, make the following replacements:

  • LOCATION: The region where the pipeline runs are located. For more information about the regions where Vertex AI Pipelines is available, see the Vertex AI locations guide.
  • PROJECT_ID: The Google Cloud project containing the pipeline runs.
  • PIPELINE_RUN_ID_1, PIPELINE_RUN_ID_2: The IDs of the pipeline jobs that you want to cancel. You can find the job ID in the Runs tab on the Pipelines page in the Google Cloud console.

HTTP method and URL:

POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/pipelineJobs:batchCancel

Request JSON body:

{
  "names": [
    "projects/PROJECT_ID/locations/LOCATION/pipelineJobs/PIPELINE_RUN_ID_1",
    "projects/PROJECT_ID/locations/LOCATION/pipelineJobs/PIPELINE_RUN_ID_2"
  ]
}

To send your request, choose one of these options:

curl

Save the request body in a file named request.json, and execute the following command:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/pipelineJobs:batchCancel"

PowerShell

Save the request body in a file named request.json, and execute the following command:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/pipelineJobs:batchCancel" | Select-Object -Expand Content

You should receive a JSON response similar to the following:

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.BatchCancelPipelineJobsOperationMetadata",
    "genericMetadata": {
      "createTime": "2025-05-25T16:11:21.011113Z",
      "updateTime": "2025-05-25T16:11:21.011113Z"
    }
  }
}

Python

Use the following sample to cancel multiple ongoing or scheduled pipeline runs by using the PipelineJob.batch_cancel method:

from google.cloud import aiplatform_v1
from google.api_core.client_options import ClientOptions
pipeline_run_ids_to_cancel = [
  "PIPELINE_RUN_ID_1",
  "PIPELINE_RUN_ID_2",
]
client_options = ClientOptions(api_endpoint=f"LOCATION-aiplatform.googleapis.com")
pipeline_job_client = aiplatform_v1.PipelineServiceClient(client_options=client_options)
pipeline_resource_names_to_cancel = []
for run_id in pipeline_run_ids_to_cancel:
  full_resource_name = f"projects/PROJECT_NUMBER/locations/LOCATION/pipelineJobs/{run_id.strip()}"
  pipeline_resource_names_to_cancel.append(full_resource_name)
parent = f"projects/PROJECT_ID/locations/LOCATION"
pipeline_job_client.batch_cancel_pipeline_jobs(parent=parent, names=pipeline_resource_names_to_cancel)

Replace the following:

  • PROJECT_ID: Your project ID.
  • LOCATION: The region where the pipeline runs were created.
  • PROJECT_NUMBER: The project number for your project. You can locate this project number in the Google Cloud console.For more information, see Find the project name, number, and ID.
  • PIPELINE_RUN_ID_1 and PIPELINE_JOB_ID_2: The unique IDs of the pipeline runs that you want to cancel. The pipeline run IDs are displayed in the Runs tab on the Pipelines page in the Google Cloud console.