From 7eac4992570d9c3ef413e2f2dbb6a83d1b0e5642 Mon Sep 17 00:00:00 2001 From: vikrant-sinha <63613816+vikrant-sinha@users.noreply.github.com> Date: Fri, 23 Apr 2021 17:55:33 +0530 Subject: [PATCH 1/2] Fix attribute error `Name` while getting the status of cluster `cluster.status.State.Name(cluster.status.state),` this code will throw an attribute error when executed because it's trying to access State.Name which is not a function of class ClusterStatus.State A better approach will be to use the `cluster.status.state.name` as State is of enum type --- samples/snippets/submit_job_to_cluster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/submit_job_to_cluster.py b/samples/snippets/submit_job_to_cluster.py index d613cf5b..35d329c5 100644 --- a/samples/snippets/submit_job_to_cluster.py +++ b/samples/snippets/submit_job_to_cluster.py @@ -137,7 +137,7 @@ def list_clusters_with_details(dataproc, project, region): ( "{} - {}".format( cluster.cluster_name, - cluster.status.State.Name(cluster.status.state), + cluster.status.state.name, ) ) ) From 1c38d63572691787ac6c97bd2ab2e52211c05fb9 Mon Sep 17 00:00:00 2001 From: vikrant-sinha Date: Mon, 21 Jun 2021 16:22:39 +0530 Subject: [PATCH 2/2] fix:attribute error Name while getting the status of cluster --- samples/snippets/list_clusters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/list_clusters.py b/samples/snippets/list_clusters.py index f0e7bac3..916f1a54 100644 --- a/samples/snippets/list_clusters.py +++ b/samples/snippets/list_clusters.py @@ -32,7 +32,7 @@ def list_clusters(dataproc, project, region): ( "{} - {}".format( cluster.cluster_name, - cluster.status.State.Name(cluster.status.state), + cluster.status.state.name ) ) )