Skip to content

Commit

Permalink
Fix: race condition due to same class name in 2 different runbooks wi…
Browse files Browse the repository at this point in the history
…thin product

Change-Id: I6a98a3bcee7a4a79bc5e89f9edc28a85fc20c1f0
GitOrigin-RevId: 1369086a7948a33b5bb05a4f29be154e9faa4e9c
  • Loading branch information
vinay-vgs authored and copybara-github committed Dec 1, 2024
1 parent 60cb824 commit f8c02f2
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 7 deletions.
4 changes: 2 additions & 2 deletions gcpdiag/runbook/dataproc/spark_job_failures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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'
Expand Down
6 changes: 4 additions & 2 deletions gcpdiag/runbook/dataproc/templates/dataproc_attributes.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 4 additions & 2 deletions website/content/en/runbook/steps/dataproc/cluster-exists.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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}



<!--
This file is auto-generated. DO NOT EDIT
Make pages changes in the corresponding jinja template
or python code
-->

0 comments on commit f8c02f2

Please sign in to comment.