ProportionalCapacityPreemptionPolicy implements SchedulingEditPolicy, CapacitySchedulerPreemptionContext { @Override public synchronized void editSchedule() { updateConfigIfNeeded(); long startTs = clock.getTime(); CSQueue root = scheduler.getRootQueue(); Resource clusterResources = Resources.clone(scheduler.getClusterResource()); containerBasedPreemptOrKill(root, clusterResources); if (LOG.isDebugEnabled()) { LOG.debug("Total time used=" + (clock.getTime() - startTs) + " ms."); } } ProportionalCapacityPreemptionPolicy(); @VisibleForTesting  ProportionalCapacityPreemptionPolicy(RMContext context,
      CapacityScheduler scheduler, Clock clock); void init(Configuration config, RMContext context,
      ResourceScheduler sched); @Override ResourceCalculator getResourceCalculator(); @Override synchronized void editSchedule(); @Override long getMonitoringInterval(); @Override String getPolicyName(); @VisibleForTesting Map<RMContainer, Long> getToPreemptContainers(); @Override TempQueuePerPartition getQueueByPartition(String queueName,
      String partition); @Override Collection<TempQueuePerPartition> getQueuePartitions(String queueName); @Override CapacityScheduler getScheduler(); @Override RMContext getRMContext(); @Override boolean isObserveOnly(); @Override Set<ContainerId> getKillableContainers(); @Override double getMaxIgnoreOverCapacity(); @Override double getNaturalTerminationFactor(); @Override Set<String> getLeafQueueNames(); @Override Set<String> getAllPartitions(); @Override int getClusterMaxApplicationPriority(); @Override float getMaxAllowableLimitForIntraQueuePreemption(); @Override float getMinimumThresholdForIntraQueuePreemption(); @Override Resource getPartitionResource(String partition); LinkedHashSet<String> getUnderServedQueuesPerPartition(
      String partition); void addPartitionToUnderServedQueues(String queueName,
      String partition); @Override IntraQueuePreemptionOrderPolicy getIntraQueuePreemptionOrderPolicy(); @Override long getDefaultMaximumKillWaitTimeout();  }
@Test public void testPreemptionWithVCoreResource() { int[][] qData = new int[][]{ {100, 100, 100}, {5, 1, 1}, {2, 0, 0}, }; String[][] resData = new String[][]{ {"100:100", "50:50", "50:50"}, {"10:100", "10:100", "0"}, {"70:20", "70:20", "10:100"}, {"0", "0", "0"}, {"-1", "1:10", "1:10"}, }; ProportionalCapacityPreemptionPolicy policy = buildPolicy(qData, resData, true); policy.editSchedule(); verify(mDisp, times(5)).handle(argThat(new IsPreemptionRequestFor(appA))); }