Class ResourceCalculationDriver
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.ResourceCalculationDriver
- Direct Known Subclasses:
RootCalculationDriver
Drives the main logic of resource calculation for all children under a queue. Acts as a
bookkeeper of disposable update information that is used by all children under the common parent.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<String,ResourceVector> protected final Collection<String>protected final Map<String,ResourceVector> protected final Map<String,ResourceVector> protected final CSQueueprotected final QueueResourceRoundingStrategyprotected final QueueCapacityUpdateContext -
Constructor Summary
ConstructorsConstructorDescriptionResourceCalculationDriver(CSQueue queue, QueueCapacityUpdateContext updateContext, Map<QueueCapacityVector.ResourceUnitCapacityType, AbstractQueueCapacityCalculator> calculators, Collection<String> definedResources) -
Method Summary
Modifier and TypeMethodDescriptionvoidCalculates and sets the minimum and maximum effective resources for all children under the parent queue with which this driver was initialized.getBatchRemainingResource(String label) Returns the remaining resources of a parent that is still available for its children.Returns all the children defined under the driver parent queue.Returns the ratio of the summary of children absolute configured resources and the parent's effective minimum resource.doublegetParentAbsoluteMaxCapacity(String label, String resourceName) Returns the ratio of the parent queue's effective maximum resource relative to the full cluster resource.doublegetParentAbsoluteMinCapacity(String label, String resourceName) Returns the ratio of the parent queue's effective minimum resource relative to the full cluster resource.getQueue()Returns the parent that is driving the calculation.doublegetRemainingRatioOfResource(String label, String resourceName) Returns the remaining resource ratio under the parent queue.doublegetSumWeightsByResource(String label, String resourceName) Returns the aggregated children weights.Returns the context that is used throughout the whole update phase.voidincrementWeight(String label, String resourceName, double value) Increments the aggregated weight.
-
Field Details
-
roundingStrategy
-
queue
-
updateContext
-
calculators
protected final Map<QueueCapacityVector.ResourceUnitCapacityType,AbstractQueueCapacityCalculator> calculators -
definedResources
-
overallRemainingResourcePerLabel
-
batchRemainingResourcePerLabel
-
normalizedResourceRatioPerLabel
-
sumWeightsPerLabel
-
usedResourceByCurrentCalculatorPerLabel
-
-
Constructor Details
-
ResourceCalculationDriver
public ResourceCalculationDriver(CSQueue queue, QueueCapacityUpdateContext updateContext, Map<QueueCapacityVector.ResourceUnitCapacityType, AbstractQueueCapacityCalculator> calculators, Collection<String> definedResources)
-
-
Method Details
-
getQueue
Returns the parent that is driving the calculation.- Returns:
- a common parent queue
-
getChildQueues
Returns all the children defined under the driver parent queue.- Returns:
- child queues
-
getUpdateContext
Returns the context that is used throughout the whole update phase.- Returns:
- update context
-
incrementWeight
Increments the aggregated weight.- Parameters:
label- node labelresourceName- resource unit namevalue- weight value
-
getSumWeightsByResource
Returns the aggregated children weights.- Parameters:
label- node labelresourceName- resource unit name- Returns:
- aggregated weights of children
-
getNormalizedResourceRatios
Returns the ratio of the summary of children absolute configured resources and the parent's effective minimum resource.- Returns:
- normalized resource ratio for all labels
-
getRemainingRatioOfResource
Returns the remaining resource ratio under the parent queue. The remaining resource is only decremented after a capacity type is fully evaluated.- Parameters:
label- node labelresourceName- name of resource unit- Returns:
- resource ratio
-
getParentAbsoluteMinCapacity
Returns the ratio of the parent queue's effective minimum resource relative to the full cluster resource.- Parameters:
label- node labelresourceName- name of resource unit- Returns:
- absolute minimum capacity
-
getParentAbsoluteMaxCapacity
Returns the ratio of the parent queue's effective maximum resource relative to the full cluster resource.- Parameters:
label- node labelresourceName- name of resource unit- Returns:
- absolute maximum capacity
-
getBatchRemainingResource
Returns the remaining resources of a parent that is still available for its children. Decremented only after the calculator is finished its work on the corresponding resources.- Parameters:
label- node label- Returns:
- remaining resources
-
calculateResources
public void calculateResources()Calculates and sets the minimum and maximum effective resources for all children under the parent queue with which this driver was initialized.
-