From f8c02f28b3f838a022936501148cf7e840ef594b Mon Sep 17 00:00:00 2001 From: Vinay Gahlout Date: Sun, 1 Dec 2024 07:27:06 +0000 Subject: [PATCH] Fix: race condition due to same class name in 2 different runbooks within product Change-Id: I6a98a3bcee7a4a79bc5e89f9edc28a85fc20c1f0 GitOrigin-RevId: 1369086a7948a33b5bb05a4f29be154e9faa4e9c --- .../runbook/dataproc/spark_job_failures.py | 4 +-- .../templates/dataproc_attributes.jinja | 6 ++-- .../dataproc/spark-job-failures.md | 2 +- .../runbook/steps/dataproc/cluster-exists.md | 6 ++-- .../dataproc/data-proc-cluster-exists.md | 36 +++++++++++++++++++ 5 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 website/content/en/runbook/steps/dataproc/data-proc-cluster-exists.md diff --git a/gcpdiag/runbook/dataproc/spark_job_failures.py b/gcpdiag/runbook/dataproc/spark_job_failures.py index 8616b8d97..9c807d686 100644 --- a/gcpdiag/runbook/dataproc/spark_job_failures.py +++ b/gcpdiag/runbook/dataproc/spark_job_failures.py @@ -99,7 +99,7 @@ def build_tree(self): job_exist = JobExists() self.add_start(job_exist) # Check cluster exists - cluster_exists = ClusterExists() + cluster_exists = DataProcClusterExists() self.add_step(parent=job_exist, child=cluster_exists) # Check stackdriver enabled stackdriver_setting = CheckStackdriverSetting() @@ -257,7 +257,7 @@ def execute(self): return -class ClusterExists(runbook.Step): +class DataProcClusterExists(runbook.Step): """Verify if cluster exists in Dataproc UI.""" template = 'job::cluster_exists' diff --git a/gcpdiag/runbook/dataproc/templates/dataproc_attributes.jinja b/gcpdiag/runbook/dataproc/templates/dataproc_attributes.jinja index 1272f0e83..53ed112c4 100644 --- a/gcpdiag/runbook/dataproc/templates/dataproc_attributes.jinja +++ b/gcpdiag/runbook/dataproc/templates/dataproc_attributes.jinja @@ -3,12 +3,14 @@ Cluster {cluster_name} exists in project {project_id} {% endblock cluster_name_exists_success_reason %} {% block cluster_name_exists_failure_reason %} -Cluster {cluster_name} doesn't exists in project {project_id} +Cluster {cluster_name} does not exists in project {project_id} {% endblock cluster_name_exists_failure_reason %} {% block cluster_name_exists_failure_remediation %} Either create again the cluster and keep it in ERROR state in Dataproc UI or manually provide additional parameters using command: -gcpdiag runbook dataproc/cluster-creation -p cluster_name=CLUSTER_NAME -p cluster_uuid=CLUSTER_UUID -p network=NETWORK_URI -p subnetwork=SUBNETWORK_URI -p service_account=SERVICE_ACCOUNT -p internal_ip_only=True/False --project=PROJECT_ID. + +`gcpdiag runbook dataproc/cluster-creation -p cluster_name=CLUSTER_NAME -p cluster_uuid=CLUSTER_UUID -p network=NETWORK_URI -p subnetwork=SUBNETWORK_URI -p service_account=SERVICE_ACCOUNT -p internal_ip_only=True/False --project=PROJECT_ID` + Please visit https://gcpdiag.dev/runbook/diagnostic-trees/dataproc/ for any additional parameters you would like to specify. {% endblock cluster_name_exists_failure_remediation %} diff --git a/website/content/en/runbook/diagnostic-trees/dataproc/spark-job-failures.md b/website/content/en/runbook/diagnostic-trees/dataproc/spark-job-failures.md index f921fe027..c1a7aad34 100644 --- a/website/content/en/runbook/diagnostic-trees/dataproc/spark-job-failures.md +++ b/website/content/en/runbook/diagnostic-trees/dataproc/spark-job-failures.md @@ -68,7 +68,7 @@ gcpdiag runbook --help - [Job Exists](/runbook/steps/dataproc/job-exists) - - [Cluster Exists](/runbook/steps/dataproc/cluster-exists) + - [Data Proc Cluster Exists](/runbook/steps/dataproc/data-proc-cluster-exists) - [Check Stackdriver Setting](/runbook/steps/dataproc/check-stackdriver-setting) diff --git a/website/content/en/runbook/steps/dataproc/cluster-exists.md b/website/content/en/runbook/steps/dataproc/cluster-exists.md index aeab20eed..92bc3bd15 100644 --- a/website/content/en/runbook/steps/dataproc/cluster-exists.md +++ b/website/content/en/runbook/steps/dataproc/cluster-exists.md @@ -16,12 +16,14 @@ Ensures both project_id and cluster_name parameters are available. ### Failure Reason -Cluster {cluster_name} doesn't exists in project {project_id} +Cluster {cluster_name} does not exists in project {project_id} ### Failure Remediation Either create again the cluster and keep it in ERROR state in Dataproc UI or manually provide additional parameters using command: -gcpdiag runbook dataproc/cluster-creation -p cluster_name=CLUSTER_NAME -p cluster_uuid=CLUSTER_UUID -p network=NETWORK_URI -p subnetwork=SUBNETWORK_URI -p service_account=SERVICE_ACCOUNT -p internal_ip_only=True/False --project=PROJECT_ID. + +`gcpdiag runbook dataproc/cluster-creation -p cluster_name=CLUSTER_NAME -p cluster_uuid=CLUSTER_UUID -p network=NETWORK_URI -p subnetwork=SUBNETWORK_URI -p service_account=SERVICE_ACCOUNT -p internal_ip_only=True/False --project=PROJECT_ID` + Please visit https://gcpdiag.dev/runbook/diagnostic-trees/dataproc/ for any additional parameters you would like to specify. ### Success Reason diff --git a/website/content/en/runbook/steps/dataproc/data-proc-cluster-exists.md b/website/content/en/runbook/steps/dataproc/data-proc-cluster-exists.md new file mode 100644 index 000000000..a717ea025 --- /dev/null +++ b/website/content/en/runbook/steps/dataproc/data-proc-cluster-exists.md @@ -0,0 +1,36 @@ +--- +title: "dataproc/Data Proc Cluster Exists" +linkTitle: "Data Proc Cluster Exists" +weight: 3 +type: docs +description: > + Verify if cluster exists in Dataproc UI. +--- + +**Product**: [Cloud Dataproc](https://cloud.google.com/dataproc)\ +**Step Type**: AUTOMATED STEP + +### Description + +None + +### Failure Reason + +The cluster: {cluster_name} doesn't exists in project {project_id} + +### Failure Remediation + +Please check if you deleted the cluster. + +### Success Reason + +The cluster: {cluster_name} exists in project {project_id} + + + +