Skip to content

Commit 5bbf6aa

Browse files
committed
update
1 parent 0a84349 commit 5bbf6aa

File tree

11 files changed

+96
-209
lines changed

11 files changed

+96
-209
lines changed

databricks/sdk/apps/v2/impl.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from enum import Enum
88
from 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

1212
_LOG = logging.getLogger("databricks.sdk")
1313

@@ -1068,7 +1068,7 @@ class AppsAPI:
10681068
def __init__(self, api_client):
10691069
self._api = api_client
10701070

1071-
def create(self, *, app: Optional[App] = None, no_compute: Optional[bool] = None) -> Wait[App]:
1071+
def create(self, *, app: Optional[App] = None, no_compute: Optional[bool] = None) -> App:
10721072
"""Create an app.
10731073
10741074
Creates a new app.
@@ -1090,8 +1090,8 @@ def create(self, *, app: Optional[App] = None, no_compute: Optional[bool] = None
10901090
"Content-Type": "application/json",
10911091
}
10921092

1093-
op_response = self._api.do("POST", "/api/2.0/apps", query=query, body=body, headers=headers)
1094-
return Wait(self.WaitGetAppActive, response=App.from_dict(op_response), name=op_response["name"])
1093+
res = self._api.do("POST", "/api/2.0/apps", query=query, body=body, headers=headers)
1094+
return App.from_dict(res)
10951095

10961096
def delete(self, name: str) -> App:
10971097
"""Delete an app.
@@ -1111,7 +1111,7 @@ def delete(self, name: str) -> App:
11111111
res = self._api.do("DELETE", f"/api/2.0/apps/{name}", headers=headers)
11121112
return App.from_dict(res)
11131113

1114-
def deploy(self, app_name: str, *, app_deployment: Optional[AppDeployment] = None) -> Wait[AppDeployment]:
1114+
def deploy(self, app_name: str, *, app_deployment: Optional[AppDeployment] = None) -> AppDeployment:
11151115
"""Create an app deployment.
11161116
11171117
Creates an app deployment for the app with the supplied name.
@@ -1130,13 +1130,8 @@ def deploy(self, app_name: str, *, app_deployment: Optional[AppDeployment] = Non
11301130
"Content-Type": "application/json",
11311131
}
11321132

1133-
op_response = self._api.do("POST", f"/api/2.0/apps/{app_name}/deployments", body=body, headers=headers)
1134-
return Wait(
1135-
self.WaitGetDeploymentAppSucceeded,
1136-
response=AppDeployment.from_dict(op_response),
1137-
app_name=app_name,
1138-
deployment_id=op_response["deployment_id"],
1139-
)
1133+
res = self._api.do("POST", f"/api/2.0/apps/{app_name}/deployments", body=body, headers=headers)
1134+
return AppDeployment.from_dict(res)
11401135

11411136
def get(self, name: str) -> App:
11421137
"""Get an app.
@@ -1303,7 +1298,7 @@ def set_permissions(
13031298
res = self._api.do("PUT", f"/api/2.0/permissions/apps/{app_name}", body=body, headers=headers)
13041299
return AppPermissions.from_dict(res)
13051300

1306-
def start(self, name: str) -> Wait[App]:
1301+
def start(self, name: str) -> App:
13071302
"""Start an app.
13081303
13091304
Start the last active deployment of the app in the workspace.
@@ -1321,10 +1316,10 @@ def start(self, name: str) -> Wait[App]:
13211316
"Content-Type": "application/json",
13221317
}
13231318

1324-
op_response = self._api.do("POST", f"/api/2.0/apps/{name}/start", headers=headers)
1325-
return Wait(self.WaitGetAppActive, response=App.from_dict(op_response), name=op_response["name"])
1319+
res = self._api.do("POST", f"/api/2.0/apps/{name}/start", headers=headers)
1320+
return App.from_dict(res)
13261321

1327-
def stop(self, name: str) -> Wait[App]:
1322+
def stop(self, name: str) -> App:
13281323
"""Stop an app.
13291324
13301325
Stops the active deployment of the app in the workspace.
@@ -1342,8 +1337,8 @@ def stop(self, name: str) -> Wait[App]:
13421337
"Content-Type": "application/json",
13431338
}
13441339

1345-
op_response = self._api.do("POST", f"/api/2.0/apps/{name}/stop", headers=headers)
1346-
return Wait(self.WaitGetAppStopped, response=App.from_dict(op_response), name=op_response["name"])
1340+
res = self._api.do("POST", f"/api/2.0/apps/{name}/stop", headers=headers)
1341+
return App.from_dict(res)
13471342

13481343
def update(self, name: str, *, app: Optional[App] = None) -> App:
13491344
"""Update an app.

databricks/sdk/catalog/v2/impl.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from enum import Enum
88
from 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")
@@ -12287,7 +12287,7 @@ class OnlineTablesAPI:
1228712287
def __init__(self, api_client):
1228812288
self._api = api_client
1228912289

12290-
def create(self, *, table: Optional[OnlineTable] = None) -> Wait[OnlineTable]:
12290+
def create(self, *, table: Optional[OnlineTable] = None) -> OnlineTable:
1229112291
"""Create an Online Table.
1229212292

1229312293
Create a new Online Table.
@@ -12305,10 +12305,8 @@ def create(self, *, table: Optional[OnlineTable] = None) -> Wait[OnlineTable]:
1230512305
"Content-Type": "application/json",
1230612306
}
1230712307

12308-
op_response = self._api.do("POST", "/api/2.0/online-tables", body=body, headers=headers)
12309-
return Wait(
12310-
self.WaitGetOnlineTableActive, response=OnlineTable.from_dict(op_response), name=op_response["name"]
12311-
)
12308+
res = self._api.do("POST", "/api/2.0/online-tables", body=body, headers=headers)
12309+
return OnlineTable.from_dict(res)
1231212310

1231312311
def delete(self, name: str):
1231412312
"""Delete an Online Table.

databricks/sdk/compute/v2/impl.py

Lines changed: 24 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from enum import Enum
88
from 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

1131411268
class GlobalInitScriptsAPI:

0 commit comments

Comments
 (0)