@Override public RMContainer preemptContainer() { RMContainer toBePreempted = null; // Find the childQueue which is most over fair share FSQueue candidateQueue = null; Comparator<Schedulable> comparator = policy.getComparator(); for (FSQueue queue : childQueues) { if (candidateQueue == null || comparator.compare(queue, candidateQueue) > 0) { candidateQueue = queue; } } // Let the selected queue choose which of its container to preempt if (candidateQueue != null) { toBePreempted = candidateQueue.preemptContainer(); } return toBePreempted; }
@Override public RMContainer preemptContainer() { RMContainer toBePreempted = null; // Find the childQueue which is most over fair share FSQueue candidateQueue = null; Comparator<Schedulable> comparator = policy.getComparator(); for (FSQueue queue : childQueues) { if (candidateQueue == null || comparator.compare(queue, candidateQueue) > 0) { candidateQueue = queue; } } // Let the selected queue choose which of its container to preempt if (candidateQueue != null) { toBePreempted = candidateQueue.preemptContainer(); } return toBePreempted; }
/** * Fetch the subset of apps that have unmet demand. When used for * preemption-related code (as opposed to allocation), omits apps that * should not be checked for starvation. * * @param assignment whether the apps are for allocation containers, as * opposed to preemption calculations * @return Set of apps with unmet demand */ private TreeSet<FSAppAttempt> fetchAppsWithDemand(boolean assignment) { TreeSet<FSAppAttempt> pendingForResourceApps = new TreeSet<>(policy.getComparator()); readLock.lock(); try { for (FSAppAttempt app : runnableApps) { if (!Resources.isNone(app.getPendingDemand()) && (assignment || app.shouldCheckForStarvation())) { pendingForResourceApps.add(app); } } } finally { readLock.unlock(); } return pendingForResourceApps; }
Comparator<Schedulable> comparator = policy.getComparator(); FSAppAttempt candidateSched = null; readLock.lock();
Comparator<Schedulable> comparator = policy.getComparator(); FSAppAttempt candidateSched = null; readLock.lock();
TreeSet<FSQueue> sortedChildQueues = new TreeSet<>(policy.getComparator()); readLock.lock(); try {
Comparator<Schedulable> comparator = policy.getComparator(); writeLock.lock(); try {
@Override public Resource assignContainer(FSSchedulerNode node) { Resource assigned = Resources.none(); // If this queue is over its limit, reject if (!assignContainerPreCheck(node)) { return assigned; } Collections.sort(childQueues, policy.getComparator()); for (FSQueue child : childQueues) { assigned = child.assignContainer(node); if (!Resources.equals(assigned, Resources.none())) { break; } } return assigned; }
@Override public Resource assignContainer(FSSchedulerNode node) { Resource assigned = Resources.none(); // If this queue is over its limit, reject if (!assignContainerPreCheck(node)) { return assigned; } Collections.sort(childQueues, policy.getComparator()); for (FSQueue child : childQueues) { assigned = child.assignContainer(node); if (!Resources.equals(assigned, Resources.none())) { break; } } return assigned; }
Comparator<Schedulable> comparator = policy.getComparator(); writeLock.lock(); try {