Delete a hyperparameter tuning job

Stay organized with collections Save and categorize content based on your preferences.

Deletes a hyperparameter tuning job using the delete_hyperparameter_tuning_job method.

Code sample


To learn how to install and use the client library for Vertex AI, see Vertex AI client libraries. For more information, see the Vertex AI Python API reference documentation.

from import aiplatform

def delete_hyperparameter_tuning_job_sample(
    project: str,
    hyperparameter_tuning_job_id: str,
    location: str = "us-central1",
    api_endpoint: str = "",
    timeout: int = 300,
    # The AI Platform services require regional API endpoints.
    client_options = {"api_endpoint": api_endpoint}
    # Initialize client that will be used to create and send requests.
    # This client only needs to be created once, and can be reused for multiple requests.
    client = aiplatform.gapic.JobServiceClient(client_options=client_options)
    name = client.hyperparameter_tuning_job_path(
    response = client.delete_hyperparameter_tuning_job(name=name)
    print("Long running operation:",
    delete_hyperparameter_tuning_job_response = response.result(timeout=timeout)

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.