Skip to content

Commit 855a5e0

Browse files
authored
Fixed select_node_type error (#614)
## Changes <!-- Summary of your changes that are easy to understand --> Calling `ws.clusters.select_node_type(local_disk=True, min_memory_gb=16)` results in `AttributeError: NotAvailableInRegion`. This happened because the enum for `CloudProviderNodeStatus` changed. Updated the enum correctly ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [x] `make test` run locally - [x] `make fmt` applied
1 parent a93140d commit 855a5e0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

databricks/sdk/mixins/compute.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def select_spark_version(self,
8686
:param beta: bool
8787
:param latest: bool
8888
:param ml: bool
89+
:param genomics: bool
8990
:param gpu: bool
9091
:param scala: str
9192
:param spark_version: str
@@ -100,7 +101,7 @@ def select_spark_version(self,
100101
for version in sv.versions:
101102
if "-scala" + scala not in version.key:
102103
continue
103-
matches = ((not "apache-spark-" in version.key) and (("-ml-" in version.key) == ml)
104+
matches = (("apache-spark-" not in version.key) and (("-ml-" in version.key) == ml)
104105
and (("-hls-" in version.key) == genomics) and (("-gpu-" in version.key) == gpu)
105106
and (("-photon-" in version.key) == photon)
106107
and (("-aarch64-" in version.key) == graviton) and (("Beta" in version.name) == beta))
@@ -137,7 +138,7 @@ def _should_node_be_skipped(nt: compute.NodeType) -> bool:
137138
return False
138139
val = compute.CloudProviderNodeStatus
139140
for st in nt.node_info.status:
140-
if st in (val.NotAvailableInRegion, val.NotEnabledOnSubscription):
141+
if st in (val.NOT_AVAILABLE_IN_REGION, val.NOT_ENABLED_ON_SUBSCRIPTION):
141142
return True
142143
return False
143144

@@ -168,6 +169,8 @@ def select_node_type(self,
168169
:param photon_driver_capable: bool
169170
:param graviton: bool
170171
:param is_io_cache_enabled: bool
172+
:param support_port_forwarding: bool
173+
:param fleet: bool
171174
172175
:returns: `node_type` compatible string
173176
"""

0 commit comments

Comments
 (0)