Package com.yahoo.config.provision
Class NodeResources
java.lang.Object
com.yahoo.config.provision.NodeResources
The node resources required by an application cluster
- Author:
- bratseth
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
static final record
static enum
-
Constructor Summary
ConstructorDescriptionNodeResources
(double vcpu, double memoryGb, double diskGb, double bandwidthGbps) NodeResources
(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed) NodeResources
(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed, NodeResources.StorageType storageType) NodeResources
(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed, NodeResources.StorageType storageType, NodeResources.Architecture architecture) NodeResources
(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed, NodeResources.StorageType storageType, NodeResources.Architecture architecture, NodeResources.GpuResources gpuResources) -
Method Summary
Modifier and TypeMethodDescriptionadd
(NodeResources other) Returns this.isUnspecified() ? Optional.empty() : Optional.of(this)double
boolean
compatibleWith
(NodeResources requested) Returns true if all the resources of this are the same as or compatible with the requested resources: - Equal numbers only where request implies it (i.e not for disk if storage is any/remote, and not for bandwidth where we don't enforce constraints), - Compatible non-numbers.double
cost()
Returns the standard cost of these resources, in dollars per hourdouble
diskGb()
double
distanceTo
(NodeResources other) boolean
boolean
Returns true if all the resources of this are the same as or compatible with the given resources: - Equal numbers.static NodeResources
fromLegacyName
(String name) Create this from serial form.int
hashCode()
boolean
boolean
isZero()
Returns this with all numbers set to 0Returns this with disk speed, storage type and architecture set to anydouble
memoryGb()
multipliedBy
(double factor) boolean
satisfies
(NodeResources other) Returns true if all the resources of this are the same or larger than the given resourcessubtract
(NodeResources other) toString()
static NodeResources
double
vcpu()
with
(NodeResources.Architecture architecture) with
(NodeResources.DiskSpeed diskSpeed) with
(NodeResources.GpuResources gpuResources) with
(NodeResources.StorageType storageType) withBandwidthGbps
(double bandwidthGbps) withDiskGb
(double diskGb) withMemoryGb
(double memoryGb) withVcpu
(double vcpu) static NodeResources
zero()
-
Constructor Details
-
NodeResources
public NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps) -
NodeResources
public NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed) -
NodeResources
public NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed, NodeResources.StorageType storageType) -
NodeResources
public NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed, NodeResources.StorageType storageType, NodeResources.Architecture architecture) -
NodeResources
public NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed, NodeResources.StorageType storageType, NodeResources.Architecture architecture, NodeResources.GpuResources gpuResources)
-
-
Method Details
-
vcpu
public double vcpu() -
memoryGb
public double memoryGb() -
diskGb
public double diskGb() -
bandwidthGbps
public double bandwidthGbps() -
diskSpeed
-
storageType
-
architecture
-
gpuResources
-
cost
public double cost()Returns the standard cost of these resources, in dollars per hour -
withVcpu
-
withMemoryGb
-
withDiskGb
-
withBandwidthGbps
-
with
-
with
-
with
-
with
-
justNumbers
Returns this with disk speed, storage type and architecture set to any -
justNonNumbers
Returns this with all numbers set to 0 -
subtract
-
add
-
multipliedBy
-
equals
-
hashCode
public int hashCode() -
toString
-
satisfies
Returns true if all the resources of this are the same or larger than the given resources -
compatibleWith
Returns true if all the resources of this are the same as or compatible with the requested resources: - Equal numbers only where request implies it (i.e not for disk if storage is any/remote, and not for bandwidth where we don't enforce constraints), - Compatible non-numbers. -
equalsWhereSpecified
Returns true if all the resources of this are the same as or compatible with the given resources: - Equal numbers. - Compatible non-numbers. -
unspecified
-
isUnspecified
public boolean isUnspecified() -
distanceTo
-
asOptional
Returns this.isUnspecified() ? Optional.empty() : Optional.of(this) -
fromLegacyName
Create this from serial form.- Throws:
IllegalArgumentException
- if the given string cannot be parsed as a serial form of this
-
isZero
public boolean isZero() -
zero
-