databricks-sdk 0.24.0__tar.gz → 0.25.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of databricks-sdk might be problematic. Click here for more details.
- {databricks-sdk-0.24.0/databricks_sdk.egg-info → databricks-sdk-0.25.1}/PKG-INFO +19 -1
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/README.md +18 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/__init__.py +79 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/core.py +1 -1
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/errors/base.py +45 -1
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/errors/mapper.py +9 -1
- databricks-sdk-0.25.1/databricks/sdk/errors/overrides.py +25 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/mixins/compute.py +5 -2
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/catalog.py +367 -244
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/compute.py +78 -23
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/iam.py +16 -24
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/jobs.py +55 -65
- databricks-sdk-0.25.1/databricks/sdk/service/marketplace.py +3571 -0
- databricks-sdk-0.25.1/databricks/sdk/version.py +1 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1/databricks_sdk.egg-info}/PKG-INFO +19 -1
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks_sdk.egg-info/SOURCES.txt +2 -0
- databricks-sdk-0.24.0/databricks/sdk/version.py +0 -1
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/LICENSE +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/NOTICE +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/__init__.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/_widgets/__init__.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/_widgets/default_widgets_utils.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/_widgets/ipywidgets_utils.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/azure.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/casing.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/clock.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/config.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/credentials_provider.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/dbutils.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/environments.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/errors/__init__.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/errors/platform.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/errors/sdk.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/mixins/__init__.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/mixins/files.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/mixins/workspace.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/oauth.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/py.typed +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/retries.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/runtime/__init__.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/runtime/dbutils_stub.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/__init__.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/_internal.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/billing.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/dashboards.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/files.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/ml.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/oauth2.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/pipelines.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/provisioning.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/serving.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/settings.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/sharing.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/sql.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/vectorsearch.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks/sdk/service/workspace.py +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks_sdk.egg-info/dependency_links.txt +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks_sdk.egg-info/requires.txt +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/databricks_sdk.egg-info/top_level.txt +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/setup.cfg +0 -0
- {databricks-sdk-0.24.0 → databricks-sdk-0.25.1}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: databricks-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.25.1
|
|
4
4
|
Summary: Databricks SDK for Python (Beta)
|
|
5
5
|
Home-page: https://databricks-sdk-py.readthedocs.io
|
|
6
6
|
Author: Serge Smertin
|
|
@@ -59,6 +59,7 @@ The SDK's internal HTTP client is robust and handles failures on different level
|
|
|
59
59
|
- [Long-running operations](#long-running-operations)
|
|
60
60
|
- [Paginated responses](#paginated-responses)
|
|
61
61
|
- [Single-sign-on with OAuth](#single-sign-on-sso-with-oauth)
|
|
62
|
+
- [Error handling](#error-handling)
|
|
62
63
|
- [Logging](#logging)
|
|
63
64
|
- [Integration with `dbutils`](#interaction-with-dbutils)
|
|
64
65
|
- [Interface stability](#interface-stability)
|
|
@@ -536,6 +537,23 @@ logging.info(f'Created new custom app: '
|
|
|
536
537
|
f'--client_secret {custom_app.client_secret}')
|
|
537
538
|
```
|
|
538
539
|
|
|
540
|
+
## Error handling<a id="error-handling"></a>
|
|
541
|
+
|
|
542
|
+
The Databricks SDK for Python provides a robust error-handling mechanism that allows developers to catch and handle API errors. When an error occurs, the SDK will raise an exception that contains information about the error, such as the HTTP status code, error message, and error details. Developers can catch these exceptions and handle them appropriately in their code.
|
|
543
|
+
|
|
544
|
+
```python
|
|
545
|
+
from databricks.sdk import WorkspaceClient
|
|
546
|
+
from databricks.sdk.errors import ResourceDoesNotExist
|
|
547
|
+
|
|
548
|
+
w = WorkspaceClient()
|
|
549
|
+
try:
|
|
550
|
+
w.clusters.get(cluster_id='1234-5678-9012')
|
|
551
|
+
except ResourceDoesNotExist as e:
|
|
552
|
+
print(f'Cluster not found: {e}')
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
The SDK handles inconsistencies in error responses amongst the different services, providing a consistent interface for developers to work with. Simply catch the appropriate exception type and handle the error as needed. The errors returned by the Databricks API are defined in [databricks/sdk/errors/platform.py](https://github.com/databricks/databricks-sdk-py/blob/main/databricks/sdk/errors/platform.py).
|
|
556
|
+
|
|
539
557
|
## Logging<a id="logging"></a>
|
|
540
558
|
|
|
541
559
|
The Databricks SDK for Python seamlessly integrates with the standard [Logging facility for Python](https://docs.python.org/3/library/logging.html).
|
|
@@ -30,6 +30,7 @@ The SDK's internal HTTP client is robust and handles failures on different level
|
|
|
30
30
|
- [Long-running operations](#long-running-operations)
|
|
31
31
|
- [Paginated responses](#paginated-responses)
|
|
32
32
|
- [Single-sign-on with OAuth](#single-sign-on-sso-with-oauth)
|
|
33
|
+
- [Error handling](#error-handling)
|
|
33
34
|
- [Logging](#logging)
|
|
34
35
|
- [Integration with `dbutils`](#interaction-with-dbutils)
|
|
35
36
|
- [Interface stability](#interface-stability)
|
|
@@ -507,6 +508,23 @@ logging.info(f'Created new custom app: '
|
|
|
507
508
|
f'--client_secret {custom_app.client_secret}')
|
|
508
509
|
```
|
|
509
510
|
|
|
511
|
+
## Error handling<a id="error-handling"></a>
|
|
512
|
+
|
|
513
|
+
The Databricks SDK for Python provides a robust error-handling mechanism that allows developers to catch and handle API errors. When an error occurs, the SDK will raise an exception that contains information about the error, such as the HTTP status code, error message, and error details. Developers can catch these exceptions and handle them appropriately in their code.
|
|
514
|
+
|
|
515
|
+
```python
|
|
516
|
+
from databricks.sdk import WorkspaceClient
|
|
517
|
+
from databricks.sdk.errors import ResourceDoesNotExist
|
|
518
|
+
|
|
519
|
+
w = WorkspaceClient()
|
|
520
|
+
try:
|
|
521
|
+
w.clusters.get(cluster_id='1234-5678-9012')
|
|
522
|
+
except ResourceDoesNotExist as e:
|
|
523
|
+
print(f'Cluster not found: {e}')
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
The SDK handles inconsistencies in error responses amongst the different services, providing a consistent interface for developers to work with. Simply catch the appropriate exception type and handle the error as needed. The errors returned by the Databricks API are defined in [databricks/sdk/errors/platform.py](https://github.com/databricks/databricks-sdk-py/blob/main/databricks/sdk/errors/platform.py).
|
|
527
|
+
|
|
510
528
|
## Logging<a id="logging"></a>
|
|
511
529
|
|
|
512
530
|
The Databricks SDK for Python seamlessly integrates with the standard [Logging facility for Python](https://docs.python.org/3/library/logging.html).
|
|
@@ -38,6 +38,12 @@ from databricks.sdk.service.iam import (AccountAccessControlAPI,
|
|
|
38
38
|
PermissionsAPI, ServicePrincipalsAPI,
|
|
39
39
|
UsersAPI, WorkspaceAssignmentAPI)
|
|
40
40
|
from databricks.sdk.service.jobs import JobsAPI
|
|
41
|
+
from databricks.sdk.service.marketplace import (
|
|
42
|
+
ConsumerFulfillmentsAPI, ConsumerInstallationsAPI, ConsumerListingsAPI,
|
|
43
|
+
ConsumerPersonalizationRequestsAPI, ConsumerProvidersAPI,
|
|
44
|
+
ProviderExchangeFiltersAPI, ProviderExchangesAPI, ProviderFilesAPI,
|
|
45
|
+
ProviderListingsAPI, ProviderPersonalizationRequestsAPI,
|
|
46
|
+
ProviderProviderAnalyticsDashboardsAPI, ProviderProvidersAPI)
|
|
41
47
|
from databricks.sdk.service.ml import ExperimentsAPI, ModelRegistryAPI
|
|
42
48
|
from databricks.sdk.service.oauth2 import (CustomAppIntegrationAPI,
|
|
43
49
|
OAuthPublishedAppsAPI,
|
|
@@ -164,6 +170,11 @@ class WorkspaceClient:
|
|
|
164
170
|
self._clusters = ClustersExt(self._api_client)
|
|
165
171
|
self._command_execution = CommandExecutionAPI(self._api_client)
|
|
166
172
|
self._connections = ConnectionsAPI(self._api_client)
|
|
173
|
+
self._consumer_fulfillments = ConsumerFulfillmentsAPI(self._api_client)
|
|
174
|
+
self._consumer_installations = ConsumerInstallationsAPI(self._api_client)
|
|
175
|
+
self._consumer_listings = ConsumerListingsAPI(self._api_client)
|
|
176
|
+
self._consumer_personalization_requests = ConsumerPersonalizationRequestsAPI(self._api_client)
|
|
177
|
+
self._consumer_providers = ConsumerProvidersAPI(self._api_client)
|
|
167
178
|
self._credentials_manager = CredentialsManagerAPI(self._api_client)
|
|
168
179
|
self._current_user = CurrentUserAPI(self._api_client)
|
|
169
180
|
self._dashboard_widgets = DashboardWidgetsAPI(self._api_client)
|
|
@@ -194,6 +205,14 @@ class WorkspaceClient:
|
|
|
194
205
|
self._permissions = PermissionsAPI(self._api_client)
|
|
195
206
|
self._pipelines = PipelinesAPI(self._api_client)
|
|
196
207
|
self._policy_families = PolicyFamiliesAPI(self._api_client)
|
|
208
|
+
self._provider_exchange_filters = ProviderExchangeFiltersAPI(self._api_client)
|
|
209
|
+
self._provider_exchanges = ProviderExchangesAPI(self._api_client)
|
|
210
|
+
self._provider_files = ProviderFilesAPI(self._api_client)
|
|
211
|
+
self._provider_listings = ProviderListingsAPI(self._api_client)
|
|
212
|
+
self._provider_personalization_requests = ProviderPersonalizationRequestsAPI(self._api_client)
|
|
213
|
+
self._provider_provider_analytics_dashboards = ProviderProviderAnalyticsDashboardsAPI(
|
|
214
|
+
self._api_client)
|
|
215
|
+
self._provider_providers = ProviderProvidersAPI(self._api_client)
|
|
197
216
|
self._providers = ProvidersAPI(self._api_client)
|
|
198
217
|
self._queries = QueriesAPI(self._api_client)
|
|
199
218
|
self._query_history = QueryHistoryAPI(self._api_client)
|
|
@@ -286,6 +305,31 @@ class WorkspaceClient:
|
|
|
286
305
|
"""Connections allow for creating a connection to an external data source."""
|
|
287
306
|
return self._connections
|
|
288
307
|
|
|
308
|
+
@property
|
|
309
|
+
def consumer_fulfillments(self) -> ConsumerFulfillmentsAPI:
|
|
310
|
+
"""Fulfillments are entities that allow consumers to preview installations."""
|
|
311
|
+
return self._consumer_fulfillments
|
|
312
|
+
|
|
313
|
+
@property
|
|
314
|
+
def consumer_installations(self) -> ConsumerInstallationsAPI:
|
|
315
|
+
"""Installations are entities that allow consumers to interact with Databricks Marketplace listings."""
|
|
316
|
+
return self._consumer_installations
|
|
317
|
+
|
|
318
|
+
@property
|
|
319
|
+
def consumer_listings(self) -> ConsumerListingsAPI:
|
|
320
|
+
"""Listings are the core entities in the Marketplace."""
|
|
321
|
+
return self._consumer_listings
|
|
322
|
+
|
|
323
|
+
@property
|
|
324
|
+
def consumer_personalization_requests(self) -> ConsumerPersonalizationRequestsAPI:
|
|
325
|
+
"""Personalization Requests allow customers to interact with the individualized Marketplace listing flow."""
|
|
326
|
+
return self._consumer_personalization_requests
|
|
327
|
+
|
|
328
|
+
@property
|
|
329
|
+
def consumer_providers(self) -> ConsumerProvidersAPI:
|
|
330
|
+
"""Providers are the entities that publish listings to the Marketplace."""
|
|
331
|
+
return self._consumer_providers
|
|
332
|
+
|
|
289
333
|
@property
|
|
290
334
|
def credentials_manager(self) -> CredentialsManagerAPI:
|
|
291
335
|
"""Credentials manager interacts with with Identity Providers to to perform token exchanges using stored credentials and refresh tokens."""
|
|
@@ -436,6 +480,41 @@ class WorkspaceClient:
|
|
|
436
480
|
"""View available policy families."""
|
|
437
481
|
return self._policy_families
|
|
438
482
|
|
|
483
|
+
@property
|
|
484
|
+
def provider_exchange_filters(self) -> ProviderExchangeFiltersAPI:
|
|
485
|
+
"""Marketplace exchanges filters curate which groups can access an exchange."""
|
|
486
|
+
return self._provider_exchange_filters
|
|
487
|
+
|
|
488
|
+
@property
|
|
489
|
+
def provider_exchanges(self) -> ProviderExchangesAPI:
|
|
490
|
+
"""Marketplace exchanges allow providers to share their listings with a curated set of customers."""
|
|
491
|
+
return self._provider_exchanges
|
|
492
|
+
|
|
493
|
+
@property
|
|
494
|
+
def provider_files(self) -> ProviderFilesAPI:
|
|
495
|
+
"""Marketplace offers a set of file APIs for various purposes such as preview notebooks and provider icons."""
|
|
496
|
+
return self._provider_files
|
|
497
|
+
|
|
498
|
+
@property
|
|
499
|
+
def provider_listings(self) -> ProviderListingsAPI:
|
|
500
|
+
"""Listings are the core entities in the Marketplace."""
|
|
501
|
+
return self._provider_listings
|
|
502
|
+
|
|
503
|
+
@property
|
|
504
|
+
def provider_personalization_requests(self) -> ProviderPersonalizationRequestsAPI:
|
|
505
|
+
"""Personalization requests are an alternate to instantly available listings."""
|
|
506
|
+
return self._provider_personalization_requests
|
|
507
|
+
|
|
508
|
+
@property
|
|
509
|
+
def provider_provider_analytics_dashboards(self) -> ProviderProviderAnalyticsDashboardsAPI:
|
|
510
|
+
"""Manage templated analytics solution for providers."""
|
|
511
|
+
return self._provider_provider_analytics_dashboards
|
|
512
|
+
|
|
513
|
+
@property
|
|
514
|
+
def provider_providers(self) -> ProviderProvidersAPI:
|
|
515
|
+
"""Providers are entities that manage assets in Marketplace."""
|
|
516
|
+
return self._provider_providers
|
|
517
|
+
|
|
439
518
|
@property
|
|
440
519
|
def providers(self) -> ProvidersAPI:
|
|
441
520
|
"""A data provider is an object representing the organization in the real world who shares the data."""
|
|
@@ -264,7 +264,7 @@ class ApiClient:
|
|
|
264
264
|
if is_too_many_requests_or_unavailable:
|
|
265
265
|
kwargs['retry_after_secs'] = self._parse_retry_after(response)
|
|
266
266
|
kwargs['message'] = message
|
|
267
|
-
return error_mapper(
|
|
267
|
+
return error_mapper(response, kwargs)
|
|
268
268
|
|
|
269
269
|
def _record_request_log(self, response: requests.Response, raw=False):
|
|
270
270
|
if not logger.isEnabledFor(logging.DEBUG):
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import re
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Dict, List, Optional
|
|
4
|
+
|
|
5
|
+
import requests
|
|
2
6
|
|
|
3
7
|
|
|
4
8
|
class ErrorDetail:
|
|
@@ -63,3 +67,43 @@ class DatabricksError(IOError):
|
|
|
63
67
|
if self.details == None:
|
|
64
68
|
return []
|
|
65
69
|
return [detail for detail in self.details if detail.type == error_type]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@dataclass
|
|
73
|
+
class _ErrorOverride:
|
|
74
|
+
# The name of the override. Used for logging purposes.
|
|
75
|
+
debug_name: str
|
|
76
|
+
|
|
77
|
+
# A regex that must match the path of the request for this override to be applied.
|
|
78
|
+
path_regex: re.Pattern
|
|
79
|
+
|
|
80
|
+
# The HTTP method of the request for the override to apply
|
|
81
|
+
verb: str
|
|
82
|
+
|
|
83
|
+
# The custom error class to use for this override.
|
|
84
|
+
custom_error: type
|
|
85
|
+
|
|
86
|
+
# A regular expression that must match the error code for this override to be applied. If None,
|
|
87
|
+
# this field is ignored.
|
|
88
|
+
status_code_matcher: Optional[re.Pattern] = None
|
|
89
|
+
|
|
90
|
+
# A regular expression that must match the error code for this override to be applied. If None,
|
|
91
|
+
# this field is ignored.
|
|
92
|
+
error_code_matcher: Optional[re.Pattern] = None
|
|
93
|
+
|
|
94
|
+
# A regular expression that must match the message for this override to be applied. If None,
|
|
95
|
+
# this field is ignored.
|
|
96
|
+
message_matcher: Optional[re.Pattern] = None
|
|
97
|
+
|
|
98
|
+
def matches(self, response: requests.Response, raw_error: dict):
|
|
99
|
+
if response.request.method != self.verb:
|
|
100
|
+
return False
|
|
101
|
+
if not self.path_regex.match(response.request.path_url):
|
|
102
|
+
return False
|
|
103
|
+
if self.status_code_matcher and not self.status_code_matcher.match(str(response.status_code)):
|
|
104
|
+
return False
|
|
105
|
+
if self.error_code_matcher and not self.error_code_matcher.match(raw_error.get('error_code', '')):
|
|
106
|
+
return False
|
|
107
|
+
if self.message_matcher and not self.message_matcher.match(raw_error.get('message', '')):
|
|
108
|
+
return False
|
|
109
|
+
return True
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
1
3
|
from databricks.sdk.errors import platform
|
|
2
4
|
from databricks.sdk.errors.base import DatabricksError
|
|
3
5
|
|
|
6
|
+
from .overrides import _ALL_OVERRIDES
|
|
7
|
+
|
|
4
8
|
|
|
5
|
-
def error_mapper(
|
|
9
|
+
def error_mapper(response: requests.Response, raw: dict) -> DatabricksError:
|
|
10
|
+
for override in _ALL_OVERRIDES:
|
|
11
|
+
if override.matches(response, raw):
|
|
12
|
+
return override.custom_error(**raw)
|
|
13
|
+
status_code = response.status_code
|
|
6
14
|
error_code = raw.get('error_code', None)
|
|
7
15
|
if error_code in platform.ERROR_CODE_MAPPING:
|
|
8
16
|
# more specific error codes override more generic HTTP status codes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
from .base import _ErrorOverride
|
|
6
|
+
from .platform import ResourceDoesNotExist
|
|
7
|
+
|
|
8
|
+
_ALL_OVERRIDES = [
|
|
9
|
+
_ErrorOverride(debug_name="Clusters InvalidParameterValue=>ResourceDoesNotExist",
|
|
10
|
+
path_regex=re.compile(r'^/api/2\.\d/clusters/get'),
|
|
11
|
+
verb="GET",
|
|
12
|
+
status_code_matcher=re.compile(r'^400$'),
|
|
13
|
+
error_code_matcher=re.compile(r'INVALID_PARAMETER_VALUE'),
|
|
14
|
+
message_matcher=re.compile(r'Cluster .* does not exist'),
|
|
15
|
+
custom_error=ResourceDoesNotExist,
|
|
16
|
+
),
|
|
17
|
+
_ErrorOverride(debug_name="Jobs InvalidParameterValue=>ResourceDoesNotExist",
|
|
18
|
+
path_regex=re.compile(r'^/api/2\.\d/jobs/get'),
|
|
19
|
+
verb="GET",
|
|
20
|
+
status_code_matcher=re.compile(r'^400$'),
|
|
21
|
+
error_code_matcher=re.compile(r'INVALID_PARAMETER_VALUE'),
|
|
22
|
+
message_matcher=re.compile(r'Job .* does not exist'),
|
|
23
|
+
custom_error=ResourceDoesNotExist,
|
|
24
|
+
),
|
|
25
|
+
]
|
|
@@ -86,6 +86,7 @@ class ClustersExt(compute.ClustersAPI):
|
|
|
86
86
|
:param beta: bool
|
|
87
87
|
:param latest: bool
|
|
88
88
|
:param ml: bool
|
|
89
|
+
:param genomics: bool
|
|
89
90
|
:param gpu: bool
|
|
90
91
|
:param scala: str
|
|
91
92
|
:param spark_version: str
|
|
@@ -100,7 +101,7 @@ class ClustersExt(compute.ClustersAPI):
|
|
|
100
101
|
for version in sv.versions:
|
|
101
102
|
if "-scala" + scala not in version.key:
|
|
102
103
|
continue
|
|
103
|
-
matches = ((
|
|
104
|
+
matches = (("apache-spark-" not in version.key) and (("-ml-" in version.key) == ml)
|
|
104
105
|
and (("-hls-" in version.key) == genomics) and (("-gpu-" in version.key) == gpu)
|
|
105
106
|
and (("-photon-" in version.key) == photon)
|
|
106
107
|
and (("-aarch64-" in version.key) == graviton) and (("Beta" in version.name) == beta))
|
|
@@ -137,7 +138,7 @@ class ClustersExt(compute.ClustersAPI):
|
|
|
137
138
|
return False
|
|
138
139
|
val = compute.CloudProviderNodeStatus
|
|
139
140
|
for st in nt.node_info.status:
|
|
140
|
-
if st in (val.
|
|
141
|
+
if st in (val.NOT_AVAILABLE_IN_REGION, val.NOT_ENABLED_ON_SUBSCRIPTION):
|
|
141
142
|
return True
|
|
142
143
|
return False
|
|
143
144
|
|
|
@@ -168,6 +169,8 @@ class ClustersExt(compute.ClustersAPI):
|
|
|
168
169
|
:param photon_driver_capable: bool
|
|
169
170
|
:param graviton: bool
|
|
170
171
|
:param is_io_cache_enabled: bool
|
|
172
|
+
:param support_port_forwarding: bool
|
|
173
|
+
:param fleet: bool
|
|
171
174
|
|
|
172
175
|
:returns: `node_type` compatible string
|
|
173
176
|
"""
|