Skip to content
Permalink
Browse files
fix: Attribute error Name while executing the sample code (#205)
* 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

* fix:attribute error Name while getting the status of cluster
  • Loading branch information
vikrant-sinha committed Jul 2, 2021
1 parent 07bc60d commit cb0328f3bfec416be9aec34d027fe0f48aab4242
Showing with 2 additions and 2 deletions.
  1. +1 −1 samples/snippets/list_clusters.py
  2. +1 −1 samples/snippets/submit_job_to_cluster.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
)
)
)
@@ -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,
)
)
)

0 comments on commit cb0328f

Please sign in to comment.