Class AbstractQueueCapacityCalculator
java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.AbstractQueueCapacityCalculator
- Direct Known Subclasses:
AbsoluteResourceCapacityCalculator,PercentageQueueCapacityCalculator,RootQueueCapacityCalculator,WeightQueueCapacityCalculator
A strategy class to encapsulate queue capacity setup and resource calculation
logic.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract doublecalculateMaximumResource(ResourceCalculationDriver resourceCalculationDriver, CalculationContext context, String label) Calculates the maximum effective resource.abstract doublecalculateMinimumResource(ResourceCalculationDriver resourceCalculationDriver, CalculationContext context, String label) Calculates the minimum effective resource.abstract voidcalculateResourcePrerequisites(ResourceCalculationDriver resourceCalculationDriver) Executes all logic that must be called prior to the effective resource value calculations.Returns the capacity type the calculator could handle.getResourceNames(CSQueue queue, String label) Returns all resource names that are defined for the capacity type that is handled by the calculator.getResourceNames(CSQueue queue, String label, QueueCapacityVector.ResourceUnitCapacityType capacityType) Returns all resource names that are defined for a capacity type.abstract voidupdateCapacitiesAfterCalculation(ResourceCalculationDriver resourceCalculationDriver, CSQueue queue, String label) Sets the metrics and statistics after effective resource values calculation.
-
Constructor Details
-
AbstractQueueCapacityCalculator
public AbstractQueueCapacityCalculator()
-
-
Method Details
-
updateCapacitiesAfterCalculation
public abstract void updateCapacitiesAfterCalculation(ResourceCalculationDriver resourceCalculationDriver, CSQueue queue, String label) Sets the metrics and statistics after effective resource values calculation.- Parameters:
queue- the queue on which the calculations are basedresourceCalculationDriver- driver that contains the intermediate calculation results for a queue branchlabel- node label
-
getCapacityType
Returns the capacity type the calculator could handle.- Returns:
- capacity type
-
calculateMinimumResource
public abstract double calculateMinimumResource(ResourceCalculationDriver resourceCalculationDriver, CalculationContext context, String label) Calculates the minimum effective resource.- Parameters:
resourceCalculationDriver- driver that contains the intermediate calculation results for a queue branchcontext- the units evaluated in the current iteration phaselabel- node label- Returns:
- minimum effective resource
-
calculateMaximumResource
public abstract double calculateMaximumResource(ResourceCalculationDriver resourceCalculationDriver, CalculationContext context, String label) Calculates the maximum effective resource.- Parameters:
resourceCalculationDriver- driver that contains the intermediate calculation results for a queue branchcontext- the units evaluated in the current iteration phaselabel- node label- Returns:
- minimum effective resource
-
calculateResourcePrerequisites
public abstract void calculateResourcePrerequisites(ResourceCalculationDriver resourceCalculationDriver) Executes all logic that must be called prior to the effective resource value calculations.- Parameters:
resourceCalculationDriver- driver that contains the parent queue on which the prerequisite calculation should be made
-
getResourceNames
Returns all resource names that are defined for the capacity type that is handled by the calculator.- Parameters:
queue- queue for which the capacity vector is definedlabel- node label- Returns:
- resource names
-
getResourceNames
protected Set<String> getResourceNames(CSQueue queue, String label, QueueCapacityVector.ResourceUnitCapacityType capacityType) Returns all resource names that are defined for a capacity type.- Parameters:
queue- queue for which the capacity vector is definedlabel- node labelcapacityType- capacity type for which the resource names are defined- Returns:
- resource names
-