Skip to content

Commit 5516b72

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
1 parent 531d5c3 commit 5516b72

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

dataproc/snippets/list_clusters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def list_clusters(dataproc, project, region):
3232
(
3333
"{} - {}".format(
3434
cluster.cluster_name,
35-
cluster.status.State.Name(cluster.status.state),
35+
cluster.status.state.name
3636
)
3737
)
3838
)

dataproc/snippets/submit_job_to_cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def list_clusters_with_details(dataproc, project, region):
137137
(
138138
"{} - {}".format(
139139
cluster.cluster_name,
140-
cluster.status.State.Name(cluster.status.state),
140+
cluster.status.state.name,
141141
)
142142
)
143143
)

0 commit comments

Comments
 (0)