Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
fix: Attribute error Name while executing the sample code (#205)
Browse files Browse the repository at this point in the history
* 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 cb0328f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion samples/snippets/list_clusters.py
Expand Up @@ -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
)
)
)
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/submit_job_to_cluster.py
Expand Up @@ -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,
)
)
)
Expand Down

0 comments on commit cb0328f

Please sign in to comment.