@Override public Map<String, Resource> getResourceDemandFromAppsPerQueue( String queueName, String partition) { Map<String, Resource> resToObtainByPartition = new HashMap<>(); TempQueuePerPartition tq = context .getQueueByPartition(queueName, partition); Collection<TempAppPerPartition> appsOrderedByPriority = tq.getApps(); Resource actualPreemptNeeded = resToObtainByPartition.get(partition); // Updating pending resource per-partition level. if (actualPreemptNeeded == null) { actualPreemptNeeded = Resources.createResource(0, 0); resToObtainByPartition.put(partition, actualPreemptNeeded); } for (TempAppPerPartition a1 : appsOrderedByPriority) { Resources.addTo(actualPreemptNeeded, a1.getActuallyToBePreempted()); } if (LOG.isDebugEnabled()) { LOG.debug("Selected to preempt " + actualPreemptNeeded + " resource from partition:" + partition); } return resToObtainByPartition; }
@Override public Collection<FiCaSchedulerApp> getPreemptableApps(String queueName, String partition) { TempQueuePerPartition tq = context.getQueueByPartition(queueName, partition); List<FiCaSchedulerApp> apps = new ArrayList<FiCaSchedulerApp>(); for (TempAppPerPartition tmpApp : tq.getApps()) { // If a lower priority app was not selected to get preempted, mark such // apps out from preemption candidate selection. if (Resources.equals(tmpApp.getActuallyToBePreempted(), Resources.none())) { continue; } apps.add(tmpApp.app); } return apps; }
tq.deductActuallyToBePreempted(context.getResourceCalculator(), tq.totalPartitionResource, res); Collection<TempAppPerPartition> tas = tq.getApps(); if (null == tas || tas.isEmpty()) { continue;
for (TempAppPerPartition tmpApp : tq.getApps()) { LOG.debug(tmpApp);