Class QueueCapacityVector
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.QueueCapacityVector
- All Implemented Interfaces:
Iterable<QueueCapacityVector.QueueCapacityVectorEntry>
public class QueueCapacityVector
extends Object
implements Iterable<QueueCapacityVector.QueueCapacityVectorEntry>
Contains capacity values with calculation types associated for each
resource.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumRepresents a capacity type associated with its syntax postfix. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a set of all capacity types defined for this vector.doubleA shorthand to retrieve the value stored for the memory resource.getResource(String resourceName) intReturns the number of resources defined for this vector.Returns the name of all resources that are defined in the given capacity type.booleanisEmpty()booleanChecks whether the vector is a mixed capacity vector (more than one capacity type is used, therefore it is not uniform).booleanisResourceOfType(String resourceName, QueueCapacityVector.ResourceUnitCapacityType capacityType) Checks whether a resource unit is defined as a specific type.iterator()static QueueCapacityVectorCreates a zeroQueueCapacityVector.static QueueCapacityVectorof(double value, QueueCapacityVector.ResourceUnitCapacityType capacityType) Creates a uniform and homogeneousQueueCapacityVector.voidsetResource(String resourceName, double value, QueueCapacityVector.ResourceUnitCapacityType capacityType) Set the value and capacity type of a resource.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
QueueCapacityVector
public QueueCapacityVector()
-
-
Method Details
-
newInstance
Creates a zeroQueueCapacityVector. The resources are defined in absolute capacity type by default.- Returns:
- zero capacity vector
-
of
public static QueueCapacityVector of(double value, QueueCapacityVector.ResourceUnitCapacityType capacityType) Creates a uniform and homogeneousQueueCapacityVector. The resources are defined in absolute capacity type by default.- Parameters:
value- value to be set for each resourcecapacityType- capacity type to be set for each resource- Returns:
- uniform capacity vector
-
getResource
-
getResourceCount
public int getResourceCount()Returns the number of resources defined for this vector.- Returns:
- number of resources
-
setResource
public void setResource(String resourceName, double value, QueueCapacityVector.ResourceUnitCapacityType capacityType) Set the value and capacity type of a resource.- Parameters:
resourceName- name of the resourcevalue- value of the resourcecapacityType- type of the resource
-
getMemory
public double getMemory()A shorthand to retrieve the value stored for the memory resource.- Returns:
- value of memory resource
-
isEmpty
public boolean isEmpty() -
getResourceNamesByCapacityType
public Set<String> getResourceNamesByCapacityType(QueueCapacityVector.ResourceUnitCapacityType capacityType) Returns the name of all resources that are defined in the given capacity type.- Parameters:
capacityType- the capacity type of the resources- Returns:
- all resource names for the given capacity type
-
isResourceOfType
public boolean isResourceOfType(String resourceName, QueueCapacityVector.ResourceUnitCapacityType capacityType) Checks whether a resource unit is defined as a specific type.- Parameters:
resourceName- resource unit namecapacityType- capacity type- Returns:
- true, if resource unit is defined as the given type
-
iterator
- Specified by:
iteratorin interfaceIterable<QueueCapacityVector.QueueCapacityVectorEntry>
-
getDefinedCapacityTypes
Returns a set of all capacity types defined for this vector.- Returns:
- capacity types
-
isMixedCapacityVector
public boolean isMixedCapacityVector()Checks whether the vector is a mixed capacity vector (more than one capacity type is used, therefore it is not uniform).- Returns:
- true, if the vector is mixed
-
getResourceNames
-
toString
-