Class AbstractQueueCapacityCalculator

java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.AbstractQueueCapacityCalculator
Direct Known Subclasses:
AbsoluteResourceCapacityCalculator, PercentageQueueCapacityCalculator, RootQueueCapacityCalculator, WeightQueueCapacityCalculator

public abstract class AbstractQueueCapacityCalculator extends Object
A strategy class to encapsulate queue capacity setup and resource calculation logic.
  • 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 based
      resourceCalculationDriver - driver that contains the intermediate calculation results for a queue branch
      label - node label
    • getCapacityType

      public abstract QueueCapacityVector.ResourceUnitCapacityType 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 branch
      context - the units evaluated in the current iteration phase
      label - 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 branch
      context - the units evaluated in the current iteration phase
      label - 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

      protected Set<String> getResourceNames(CSQueue queue, String label)
      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 defined
      label - 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 defined
      label - node label
      capacityType - capacity type for which the resource names are defined
      Returns:
      resource names