Class CapacitySchedulerPreemptionUtils

java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.CapacitySchedulerPreemptionUtils

public class CapacitySchedulerPreemptionUtils extends Object
  • Constructor Details

    • CapacitySchedulerPreemptionUtils

      public CapacitySchedulerPreemptionUtils()
  • Method Details

    • getResToObtainByPartitionForLeafQueue

      public static Map<String,org.apache.hadoop.yarn.api.records.Resource> getResToObtainByPartitionForLeafQueue(CapacitySchedulerPreemptionContext context, String queueName, org.apache.hadoop.yarn.api.records.Resource clusterResource)
    • isContainerAlreadySelected

      public static boolean isContainerAlreadySelected(RMContainer container, Map<org.apache.hadoop.yarn.api.records.ApplicationAttemptId,Set<RMContainer>> selectedCandidates)
    • deductPreemptableResourcesBasedSelectedCandidates

      public static void deductPreemptableResourcesBasedSelectedCandidates(CapacitySchedulerPreemptionContext context, Map<org.apache.hadoop.yarn.api.records.ApplicationAttemptId,Set<RMContainer>> selectedCandidates)
    • tryPreemptContainerAndDeductResToObtain

      public static boolean tryPreemptContainerAndDeductResToObtain(org.apache.hadoop.yarn.util.resource.ResourceCalculator rc, CapacitySchedulerPreemptionContext context, Map<String,org.apache.hadoop.yarn.api.records.Resource> resourceToObtainByPartitions, RMContainer rmContainer, org.apache.hadoop.yarn.api.records.Resource clusterResource, Map<org.apache.hadoop.yarn.api.records.ApplicationAttemptId,Set<RMContainer>> preemptMap, Map<org.apache.hadoop.yarn.api.records.ApplicationAttemptId,Set<RMContainer>> curCandidates, org.apache.hadoop.yarn.api.records.Resource totalPreemptionAllowed, boolean conservativeDRF)
      Invoke this method to preempt container based on resToObtain.
      Parameters:
      rc - resource calculator
      context - preemption context
      resourceToObtainByPartitions - map to hold resource to obtain per partition
      rmContainer - container
      clusterResource - total resource
      preemptMap - map to hold preempted containers
      totalPreemptionAllowed - total preemption allowed per round
      conservativeDRF - should we do conservativeDRF preemption or not. When true: stop preempt container when any major resource type <= 0 for to-preempt. This is default preemption behavior of intra-queue preemption When false: stop preempt container when: all major resource type <= 0 for to-preempt. This is default preemption behavior of inter-queue preemption
      curCandidates - RMContainer Set.
      Returns:
      should we preempt rmContainer. If we should, deduct from resourceToObtainByPartition
    • addToPreemptMap

      protected static void addToPreemptMap(Map<org.apache.hadoop.yarn.api.records.ApplicationAttemptId,Set<RMContainer>> preemptMap, Map<org.apache.hadoop.yarn.api.records.ApplicationAttemptId,Set<RMContainer>> curCandidates, org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId, RMContainer containerToPreempt)