summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@yahooinc.com>2023-09-12 11:35:44 +0200
committerØyvind Grønnesby <oyving@yahooinc.com>2023-09-12 11:40:23 +0200
commit1e935fbe86caf77ac7edb223d978846da428cf3f (patch)
treea46166ad77f9104f1a8ec4095228de573a2a7bfc
parent5e335474fccb3dbfe0e631e72648d3ae8b1ff703 (diff)
Support GPU resources in Applicaiton node API call
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeResources.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeResources.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeResources.java
index 440728ab04a..99de8289742 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeResources.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeResources.java
@@ -26,6 +26,11 @@ public class NodeResources {
private String storageType;
@JsonProperty
private String architecture;
+ @JsonProperty
+ private Double gpuCount;
+ @JsonProperty
+ private Double gpuMemoryGb;
+
public Double getVcpu() {
return vcpu;
@@ -83,11 +88,28 @@ public class NodeResources {
this.architecture = architecture;
}
+ public Double getGpuCount(){
+ return gpuCount;
+ }
+
+ public void setGpuCount(Double gpuCount) {
+ this.gpuCount = gpuCount;
+ }
+
+ public Double getGpuMemoryGb() {
+ return gpuMemoryGb;
+ }
+
+ public void setGpuMemoryGb(Double gpuMemoryGb) {
+ this.gpuMemoryGb = gpuMemoryGb;
+ }
+
public com.yahoo.config.provision.NodeResources toNodeResources() {
return new com.yahoo.config.provision.NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps,
toDiskSpeed(diskSpeed),
toStorageType(storageType),
- toArchitecture(architecture));
+ toArchitecture(architecture),
+ toGpu(gpuCount, gpuMemoryGb));
}
private com.yahoo.config.provision.NodeResources.DiskSpeed toDiskSpeed(String diskSpeed) {
@@ -117,6 +139,14 @@ public class NodeResources {
}
}
+ private com.yahoo.config.provision.NodeResources.GpuResources toGpu(Double gpuCount, Double gpuMemoryGb) {
+ // these are either both null or both have a value. using OR to silence inspection.
+ // we also cast the double to an integer. assuming this must be OK as we are going
+ // from NodeResources -> JSON -> NodeResources
+ if (gpuCount == null || gpuMemoryGb == null) return com.yahoo.config.provision.NodeResources.GpuResources.getDefault();
+ return new com.yahoo.config.provision.NodeResources.GpuResources(gpuCount.intValue(), gpuMemoryGb.intValue());
+ }
+
@Override
public String toString() {
return "NodeResources{" +
@@ -127,6 +157,8 @@ public class NodeResources {
", diskSpeed='" + diskSpeed + '\'' +
", storageType='" + storageType + '\'' +
", architecture='" + architecture + '\'' +
+ ", gpuCount='" + gpuCount + '\'' +
+ ", gpuMemoryGb='" + gpuMemoryGb + '\'' +
'}';
}
}