Class ResourceCalculationDriver

java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.ResourceCalculationDriver
Direct Known Subclasses:
RootCalculationDriver

public class ResourceCalculationDriver extends Object
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 Details

  • Constructor Details

  • Method Details

    • getQueue

      public CSQueue getQueue()
      Returns the parent that is driving the calculation.
      Returns:
      a common parent queue
    • getChildQueues

      public Collection<CSQueue> getChildQueues()
      Returns all the children defined under the driver parent queue.
      Returns:
      child queues
    • getUpdateContext

      public QueueCapacityUpdateContext getUpdateContext()
      Returns the context that is used throughout the whole update phase.
      Returns:
      update context
    • incrementWeight

      public void incrementWeight(String label, String resourceName, double value)
      Increments the aggregated weight.
      Parameters:
      label - node label
      resourceName - resource unit name
      value - weight value
    • getSumWeightsByResource

      public double getSumWeightsByResource(String label, String resourceName)
      Returns the aggregated children weights.
      Parameters:
      label - node label
      resourceName - resource unit name
      Returns:
      aggregated weights of children
    • getNormalizedResourceRatios

      public Map<String,ResourceVector> 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

      public double getRemainingRatioOfResource(String label, String resourceName)
      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 label
      resourceName - name of resource unit
      Returns:
      resource ratio
    • getParentAbsoluteMinCapacity

      public double getParentAbsoluteMinCapacity(String label, String resourceName)
      Returns the ratio of the parent queue's effective minimum resource relative to the full cluster resource.
      Parameters:
      label - node label
      resourceName - name of resource unit
      Returns:
      absolute minimum capacity
    • getParentAbsoluteMaxCapacity

      public double getParentAbsoluteMaxCapacity(String label, String resourceName)
      Returns the ratio of the parent queue's effective maximum resource relative to the full cluster resource.
      Parameters:
      label - node label
      resourceName - name of resource unit
      Returns:
      absolute maximum capacity
    • getBatchRemainingResource

      public ResourceVector getBatchRemainingResource(String label)
      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.