Skip to content

Commit

Permalink
Don't ClusterDetails
Browse files Browse the repository at this point in the history
This was requested in order to match up with the SDKs in
other languages.

This reverts commit 3f04d7c.
  • Loading branch information
judahrand committed Jul 27, 2023
1 parent 3f04d7c commit 2932d2c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions databricks/sdk/mixins/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def select_node_type(self,
return nt.node_type_id
raise ValueError("cannot determine smallest node type")

def ensure_cluster_is_running(self, cluster_id: str) -> compute.ClusterDetails:
def ensure_cluster_is_running(self, cluster_id: str) -> None:
"""Ensures that given cluster is running, regardless of the current state"""
timeout = datetime.timedelta(minutes=20)
deadline = time.time() + timeout.total_seconds()
Expand All @@ -218,14 +218,17 @@ def ensure_cluster_is_running(self, cluster_id: str) -> compute.ClusterDetails:
state = compute.State
info = self.get(cluster_id)
if info.state == state.RUNNING:
return info
return
elif info.state == state.TERMINATED:
return self.start(cluster_id).result()
self.start(cluster_id).result()
return
elif info.state == state.TERMINATING:
self.wait_get_cluster_terminated(cluster_id)
return self.start(cluster_id).result()
self.start(cluster_id).result()
return
elif info.state in (state.PENDING, state.RESIZING, state.RESTARTING):
return self.wait_get_cluster_running(cluster_id)
self.wait_get_cluster_running(cluster_id)
return
elif info.state in (state.ERROR, state.UNKNOWN):
raise RuntimeError(f'Cluster {info.cluster_name} is {info.state}: {info.state_message}')
except OperationFailed as e:
Expand Down

0 comments on commit 2932d2c

Please sign in to comment.