Skip to content

Commit 0f3d2ec

Browse files
authored
Don't consider GPU-based nodes in databricks_node_type data source until explicitly requested (#1978)
1 parent ea3acc0 commit 0f3d2ec

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

clusters/data_node_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func (a ClustersAPI) GetSmallestNodeType(r NodeTypeRequest) string {
163163
if r.MinCores > 0 && int32(nt.NumCores) < r.MinCores {
164164
continue
165165
}
166-
if r.MinGPUs > 0 && nt.NumGPUs < r.MinGPUs {
166+
if (r.MinGPUs > 0 && nt.NumGPUs < r.MinGPUs) || (r.MinGPUs == 0 && nt.NumGPUs > 0) {
167167
continue
168168
}
169169
if (r.LocalDisk || r.LocalDiskMinSize > 0) && nt.NodeInstanceType != nil &&

clusters/data_node_type_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,19 @@ func TestNodeTypeCategory(t *testing.T) {
152152
},
153153
Category: "Memory Optimized",
154154
},
155+
{
156+
NodeTypeID: "Random_02_GPU",
157+
InstanceTypeID: "Random_02_GPU",
158+
MemoryMB: 8192,
159+
NumCores: 8,
160+
NumGPUs: 2,
161+
Category: "Storage Optimized",
162+
},
155163
{
156164
NodeTypeID: "Random_02",
157165
InstanceTypeID: "Random_02",
158166
MemoryMB: 8192,
159167
NumCores: 8,
160-
NumGPUs: 2,
161168
Category: "Storage Optimized",
162169
},
163170
},
@@ -282,7 +289,6 @@ func TestNodeTypeCategoryNotAvailable(t *testing.T) {
282289
InstanceTypeID: "Random_03",
283290
MemoryMB: 8192,
284291
NumCores: 8,
285-
NumGPUs: 2,
286292
Category: "Storage Optimized",
287293
},
288294
},

0 commit comments

Comments
 (0)