Class AbstractPreemptableResourceCalculator

java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.AbstractPreemptableResourceCalculator
Direct Known Subclasses:
PreemptableResourceCalculator

public class AbstractPreemptableResourceCalculator extends Object
Calculate how much resources need to be preempted for each queue, will be used by PreemptionCandidatesSelector.
  • Field Details

    • context

      protected final CapacitySchedulerPreemptionContext context
    • rc

      protected final org.apache.hadoop.yarn.util.resource.ResourceCalculator rc
    • isReservedPreemptionCandidatesSelector

      protected boolean isReservedPreemptionCandidatesSelector
  • Constructor Details

    • AbstractPreemptableResourceCalculator

      public AbstractPreemptableResourceCalculator(CapacitySchedulerPreemptionContext preemptionContext, boolean isReservedPreemptionCandidatesSelector, boolean allowQueuesBalanceAfterAllQueuesSatisfied)
      PreemptableResourceCalculator constructor.
      Parameters:
      preemptionContext - context
      isReservedPreemptionCandidatesSelector - this will be set by different implementation of candidate selectors, please refer to TempQueuePerPartition#offer for details.
      allowQueuesBalanceAfterAllQueuesSatisfied - Should resources be preempted from an over-served queue when the requesting queues are all at or over their guarantees? An example is, there're 10 queues under root, guaranteed resource of them are all 10%. Assume there're two queues are using resources, queueA uses 10% queueB uses 90%. For all queues are guaranteed, but it's not fair for queueA. We wanna make this behavior can be configured. By default it is not allowed.
  • Method Details

    • computeFixpointAllocation

      protected void computeFixpointAllocation(org.apache.hadoop.yarn.api.records.Resource totGuarant, Collection<TempQueuePerPartition> qAlloc, org.apache.hadoop.yarn.api.records.Resource unassigned, boolean ignoreGuarantee)
      Given a set of queues compute the fix-point distribution of unassigned resources among them. As pending request of a queue are exhausted, the queue is removed from the set and remaining capacity redistributed among remaining queues. The distribution is weighted based on guaranteed capacity, unless asked to ignoreGuarantee, in which case resources are distributed uniformly.
      Parameters:
      totGuarant - total guaranteed resource
      qAlloc - List of child queues
      unassigned - Unassigned resource per queue
      ignoreGuarantee - ignore guarantee per queue.
    • initIdealAssignment

      protected void initIdealAssignment(org.apache.hadoop.yarn.api.records.Resource totGuarant, TempQueuePerPartition q, org.apache.hadoop.yarn.api.records.Resource initIdealAssigned)
      This method is visible to allow sub-classes to override the initialization behavior.
      Parameters:
      totGuarant - total resources (useful for ResourceCalculator operations)
      q - the TempQueuePerPartition being initialized
      initIdealAssigned - the proposed initialization value.