77from enum import Enum
88from typing import Any, Dict, Iterator, List, Optional
99
10- from ...service._internal import (Wait, _enum, _from_dict, _repeated_dict,
10+ from ...service._internal import (_enum, _from_dict, _repeated_dict,
1111 _repeated_enum)
1212
1313_LOG = logging.getLogger("databricks.sdk")
@@ -10047,7 +10047,7 @@ def create(
1004710047 ssh_public_keys: Optional[List[str]] = None,
1004810048 use_ml_runtime: Optional[bool] = None,
1004910049 workload_type: Optional[WorkloadType] = None,
10050- ) -> Wait[ClusterDetails] :
10050+ ) -> CreateClusterResponse :
1005110051 """Create new cluster.
1005210052
1005310053 Creates a new Spark cluster. This method will acquire new instances from the cloud provider if
@@ -10299,14 +10299,10 @@ def create(
1029910299 "Content-Type": "application/json",
1030010300 }
1030110301
10302- op_response = self._api.do("POST", "/api/2.1/clusters/create", body=body, headers=headers)
10303- return Wait(
10304- self.WaitGetClusterRunning,
10305- response=CreateClusterResponse.from_dict(op_response),
10306- cluster_id=op_response["cluster_id"],
10307- )
10302+ res = self._api.do("POST", "/api/2.1/clusters/create", body=body, headers=headers)
10303+ return CreateClusterResponse.from_dict(res)
1030810304
10309- def delete(self, cluster_id: str) -> Wait[ClusterDetails] :
10305+ def delete(self, cluster_id: str):
1031010306 """Terminate cluster.
1031110307
1031210308 Terminates the Spark cluster with the specified ID. The cluster is removed asynchronously. Once the
@@ -10328,10 +10324,7 @@ def delete(self, cluster_id: str) -> Wait[ClusterDetails]:
1032810324 "Content-Type": "application/json",
1032910325 }
1033010326
10331- op_response = self._api.do("POST", "/api/2.1/clusters/delete", body=body, headers=headers)
10332- return Wait(
10333- self.WaitGetClusterTerminated, response=DeleteClusterResponse.from_dict(op_response), cluster_id=cluster_id
10334- )
10327+ self._api.do("POST", "/api/2.1/clusters/delete", body=body, headers=headers)
1033510328
1033610329 def edit(
1033710330 self,
@@ -10367,7 +10360,7 @@ def edit(
1036710360 ssh_public_keys: Optional[List[str]] = None,
1036810361 use_ml_runtime: Optional[bool] = None,
1036910362 workload_type: Optional[WorkloadType] = None,
10370- ) -> Wait[ClusterDetails] :
10363+ ):
1037110364 """Update cluster configuration.
1037210365
1037310366 Updates the configuration of a cluster to match the provided attributes and size. A cluster can be
@@ -10616,10 +10609,7 @@ def edit(
1061610609 "Content-Type": "application/json",
1061710610 }
1061810611
10619- op_response = self._api.do("POST", "/api/2.1/clusters/edit", body=body, headers=headers)
10620- return Wait(
10621- self.WaitGetClusterRunning, response=EditClusterResponse.from_dict(op_response), cluster_id=cluster_id
10622- )
10612+ self._api.do("POST", "/api/2.1/clusters/edit", body=body, headers=headers)
1062310613
1062410614 def events(
1062510615 self,
@@ -10867,9 +10857,7 @@ def pin(self, cluster_id: str):
1086710857
1086810858 self._api.do("POST", "/api/2.1/clusters/pin", body=body, headers=headers)
1086910859
10870- def resize(
10871- self, cluster_id: str, *, autoscale: Optional[AutoScale] = None, num_workers: Optional[int] = None
10872- ) -> Wait[ClusterDetails]:
10860+ def resize(self, cluster_id: str, *, autoscale: Optional[AutoScale] = None, num_workers: Optional[int] = None):
1087310861 """Resize cluster.
1087410862
1087510863 Resizes a cluster to have a desired number of workers. This will fail unless the cluster is in a
@@ -10906,12 +10894,9 @@ def resize(
1090610894 "Content-Type": "application/json",
1090710895 }
1090810896
10909- op_response = self._api.do("POST", "/api/2.1/clusters/resize", body=body, headers=headers)
10910- return Wait(
10911- self.WaitGetClusterRunning, response=ResizeClusterResponse.from_dict(op_response), cluster_id=cluster_id
10912- )
10897+ self._api.do("POST", "/api/2.1/clusters/resize", body=body, headers=headers)
1091310898
10914- def restart(self, cluster_id: str, *, restart_user: Optional[str] = None) -> Wait[ClusterDetails] :
10899+ def restart(self, cluster_id: str, *, restart_user: Optional[str] = None):
1091510900 """Restart cluster.
1091610901
1091710902 Restarts a Spark cluster with the supplied ID. If the cluster is not currently in a `RUNNING` state,
@@ -10935,10 +10920,7 @@ def restart(self, cluster_id: str, *, restart_user: Optional[str] = None) -> Wai
1093510920 "Content-Type": "application/json",
1093610921 }
1093710922
10938- op_response = self._api.do("POST", "/api/2.1/clusters/restart", body=body, headers=headers)
10939- return Wait(
10940- self.WaitGetClusterRunning, response=RestartClusterResponse.from_dict(op_response), cluster_id=cluster_id
10941- )
10923+ self._api.do("POST", "/api/2.1/clusters/restart", body=body, headers=headers)
1094210924
1094310925 def set_permissions(
1094410926 self, cluster_id: str, *, access_control_list: Optional[List[ClusterAccessControlRequest]] = None
@@ -10980,7 +10962,7 @@ def spark_versions(self) -> GetSparkVersionsResponse:
1098010962 res = self._api.do("GET", "/api/2.1/clusters/spark-versions", headers=headers)
1098110963 return GetSparkVersionsResponse.from_dict(res)
1098210964
10983- def start(self, cluster_id: str) -> Wait[ClusterDetails] :
10965+ def start(self, cluster_id: str):
1098410966 """Start terminated cluster.
1098510967
1098610968 Starts a terminated Spark cluster with the supplied ID. This works similar to `createCluster` except:
@@ -11004,10 +10986,7 @@ def start(self, cluster_id: str) -> Wait[ClusterDetails]:
1100410986 "Content-Type": "application/json",
1100510987 }
1100610988
11007- op_response = self._api.do("POST", "/api/2.1/clusters/start", body=body, headers=headers)
11008- return Wait(
11009- self.WaitGetClusterRunning, response=StartClusterResponse.from_dict(op_response), cluster_id=cluster_id
11010- )
10989+ self._api.do("POST", "/api/2.1/clusters/start", body=body, headers=headers)
1101110990
1101210991 def unpin(self, cluster_id: str):
1101310992 """Unpin cluster.
@@ -11030,9 +11009,7 @@ def unpin(self, cluster_id: str):
1103011009
1103111010 self._api.do("POST", "/api/2.1/clusters/unpin", body=body, headers=headers)
1103211011
11033- def update(
11034- self, cluster_id: str, update_mask: str, *, cluster: Optional[UpdateClusterResource] = None
11035- ) -> Wait[ClusterDetails]:
11012+ def update(self, cluster_id: str, update_mask: str, *, cluster: Optional[UpdateClusterResource] = None):
1103611013 """Update cluster configuration (partial).
1103711014
1103811015 Updates the configuration of a cluster to match the partial set of attributes and size. Denote which
@@ -11078,10 +11055,7 @@ def update(
1107811055 "Content-Type": "application/json",
1107911056 }
1108011057
11081- op_response = self._api.do("POST", "/api/2.1/clusters/update", body=body, headers=headers)
11082- return Wait(
11083- self.WaitGetClusterRunning, response=UpdateClusterResponse.from_dict(op_response), cluster_id=cluster_id
11084- )
11058+ self._api.do("POST", "/api/2.1/clusters/update", body=body, headers=headers)
1108511059
1108611060 def update_permissions(
1108711061 self, cluster_id: str, *, access_control_list: Optional[List[ClusterAccessControlRequest]] = None
@@ -11117,7 +11091,7 @@ def __init__(self, api_client):
1111711091
1111811092 def cancel(
1111911093 self, *, cluster_id: Optional[str] = None, command_id: Optional[str] = None, context_id: Optional[str] = None
11120- ) -> Wait[CommandStatusResponse] :
11094+ ):
1112111095 """Cancel a command.
1112211096
1112311097 Cancels a currently running command within an execution context.
@@ -11144,14 +11118,7 @@ def cancel(
1114411118 "Content-Type": "application/json",
1114511119 }
1114611120
11147- op_response = self._api.do("POST", "/api/1.2/commands/cancel", body=body, headers=headers)
11148- return Wait(
11149- self.WaitCommandStatusCommandExecutionCancelled,
11150- response=CancelResponse.from_dict(op_response),
11151- cluster_id=cluster_id,
11152- command_id=command_id,
11153- context_id=context_id,
11154- )
11121+ self._api.do("POST", "/api/1.2/commands/cancel", body=body, headers=headers)
1115511122
1115611123 def command_status(self, cluster_id: str, context_id: str, command_id: str) -> CommandStatusResponse:
1115711124 """Get command info.
@@ -11204,9 +11171,7 @@ def context_status(self, cluster_id: str, context_id: str) -> ContextStatusRespo
1120411171 res = self._api.do("GET", "/api/1.2/contexts/status", query=query, headers=headers)
1120511172 return ContextStatusResponse.from_dict(res)
1120611173
11207- def create(
11208- self, *, cluster_id: Optional[str] = None, language: Optional[Language] = None
11209- ) -> Wait[ContextStatusResponse]:
11174+ def create(self, *, cluster_id: Optional[str] = None, language: Optional[Language] = None) -> Created:
1121011175 """Create an execution context.
1121111176
1121211177 Creates an execution context for running cluster commands.
@@ -11231,13 +11196,8 @@ def create(
1123111196 "Content-Type": "application/json",
1123211197 }
1123311198
11234- op_response = self._api.do("POST", "/api/1.2/contexts/create", body=body, headers=headers)
11235- return Wait(
11236- self.WaitContextStatusCommandExecutionRunning,
11237- response=Created.from_dict(op_response),
11238- cluster_id=cluster_id,
11239- context_id=op_response["id"],
11240- )
11199+ res = self._api.do("POST", "/api/1.2/contexts/create", body=body, headers=headers)
11200+ return Created.from_dict(res)
1124111201
1124211202 def destroy(self, cluster_id: str, context_id: str):
1124311203 """Delete an execution context.
@@ -11268,7 +11228,7 @@ def execute(
1126811228 command: Optional[str] = None,
1126911229 context_id: Optional[str] = None,
1127011230 language: Optional[Language] = None,
11271- ) -> Wait[CommandStatusResponse] :
11231+ ) -> Created :
1127211232 """Run a command.
1127311233
1127411234 Runs a cluster command in the given execution context, using the provided language.
@@ -11301,14 +11261,8 @@ def execute(
1130111261 "Content-Type": "application/json",
1130211262 }
1130311263
11304- op_response = self._api.do("POST", "/api/1.2/commands/execute", body=body, headers=headers)
11305- return Wait(
11306- self.WaitCommandStatusCommandExecutionFinishedOrError,
11307- response=Created.from_dict(op_response),
11308- cluster_id=cluster_id,
11309- command_id=op_response["id"],
11310- context_id=context_id,
11311- )
11264+ res = self._api.do("POST", "/api/1.2/commands/execute", body=body, headers=headers)
11265+ return Created.from_dict(res)
1131211266
1131311267
1131411268class GlobalInitScriptsAPI:
0 commit comments