diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-11-21 09:15:34 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2022-11-21 09:19:10 +0100 |
commit | 582706592fd21dd91666911f8175527a0e36d5b6 (patch) | |
tree | 782163928fea97e1652c6fecb0ffeffdae3e8837 | |
parent | 32fdbad465c00e018168a0965f2b5870f2ee1b39 (diff) |
Ensure GPU resources are included in copy methods
-rw-r--r-- | config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java | 26 | ||||
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java | 3 |
2 files changed, 19 insertions, 10 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java index e03ebb4d8da..d4827f07a80 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java @@ -214,43 +214,49 @@ public class NodeResources { public NodeResources withVcpu(double vcpu) { ensureSpecified(); if (vcpu == this.vcpu) return this; - return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture); + return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources); } public NodeResources withMemoryGb(double memoryGb) { ensureSpecified(); if (memoryGb == this.memoryGb) return this; - return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture); + return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources); } public NodeResources withDiskGb(double diskGb) { ensureSpecified(); if (diskGb == this.diskGb) return this; - return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture); + return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources); } public NodeResources withBandwidthGbps(double bandwidthGbps) { ensureSpecified(); if (bandwidthGbps == this.bandwidthGbps) return this; - return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture); + return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources); } public NodeResources with(DiskSpeed diskSpeed) { ensureSpecified(); if (diskSpeed == this.diskSpeed) return this; - return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture); + return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources); } public NodeResources with(StorageType storageType) { ensureSpecified(); if (storageType == this.storageType) return this; - return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture); + return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources); } public NodeResources with(Architecture architecture) { ensureSpecified(); if (architecture == this.architecture) return this; - return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture); + return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources); + } + + public NodeResources with(GpuResources gpuResources) { + ensureSpecified(); + if (this.gpuResources.equals(gpuResources)) return this; + return new NodeResources(vcpu, memoryGb, diskGb, bandwidthGbps, diskSpeed, storageType, architecture, gpuResources); } /** Returns this with disk speed and storage type set to any */ @@ -276,7 +282,8 @@ public class NodeResources { bandwidthGbps - other.bandwidthGbps, this.diskSpeed.combineWith(other.diskSpeed), this.storageType.combineWith(other.storageType), - this.architecture.combineWith(other.architecture)); + this.architecture.combineWith(other.architecture), + gpuResources); } public NodeResources add(NodeResources other) { @@ -289,7 +296,8 @@ public class NodeResources { bandwidthGbps + other.bandwidthGbps, this.diskSpeed.combineWith(other.diskSpeed), this.storageType.combineWith(other.storageType), - this.architecture.combineWith(other.architecture)); + this.architecture.combineWith(other.architecture), + gpuResources); } private boolean isInterchangeableWith(NodeResources other) { diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java index b1b230479ee..55b2bfc8329 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java @@ -35,7 +35,8 @@ public abstract class NodeCandidate implements Nodelike, Comparable<NodeCandidat List.of(Node.State.provisioned, Node.State.ready, Node.State.active); private static final NodeResources zeroResources = - new NodeResources(0, 0, 0, 0, NodeResources.DiskSpeed.any, NodeResources.StorageType.any); + new NodeResources(0, 0, 0, 0, NodeResources.DiskSpeed.any, NodeResources.StorageType.any, + NodeResources.Architecture.getDefault(), NodeResources.GpuResources.getDefault()); /** The free capacity on the parent of this node, before adding this node to it */ protected final NodeResources freeParentCapacity; |