/** * Remove a queue and all its descendents. */ private void removeQueue(FSQueue queue) { if (queue instanceof FSLeafQueue) { leafQueues.remove(queue); } else { List<FSQueue> childQueues = queue.getChildQueues(); while (!childQueues.isEmpty()) { removeQueue(childQueues.get(0)); } } queues.remove(queue.getName()); queue.getParent().getChildQueues().remove(queue); }
/** * Remove a queue and all its descendents. */ private void removeQueue(FSQueue queue) { if (queue instanceof FSLeafQueue) { leafQueues.remove(queue); } else { List<FSQueue> childQueues = queue.getChildQueues(); while (!childQueues.isEmpty()) { removeQueue(childQueues.get(0)); } } queues.remove(queue.getName()); queue.getParent().getChildQueues().remove(queue); }
/** * Recursively checks whether the number of queue runnable apps exceeds the * limitation. * * @param queue the current queue * @return true if the number hits the limit; false otherwise */ public boolean exceedQueueMaxRunningApps(FSQueue queue) { // Check queue and all parent queues while (queue != null) { if (queue.getNumRunnableApps() >= queue.getMaxRunningApps()) { return true; } queue = queue.getParent(); } return false; }
/** * Remove a queue and all its descendents. */ private void removeQueue(FSQueue queue) { synchronized (queues) { if (queue instanceof FSLeafQueue) { leafQueues.remove(queue); } else { for (FSQueue childQueue:queue.getChildQueues()) { removeQueue(childQueue); } } queues.remove(queue.getName()); FSParentQueue parent = queue.getParent(); parent.removeChildQueue(queue); } }
/** * After reloading the allocation config, the max resource settings for any * ad hoc queues will be missing. This method goes through the queue manager's * queue list and adds back the max resources settings for any ad hoc queues. * Note that the new max resource settings will be based on the new config. * The old settings are lost. */ private void applyChildDefaults() { Collection<FSQueue> queues = queueMgr.getQueues(); Set<String> configuredLeafQueues = allocConf.getConfiguredQueues().get(FSQueueType.LEAF); Set<String> configuredParentQueues = allocConf.getConfiguredQueues().get(FSQueueType.PARENT); for (FSQueue queue : queues) { // If the queue is ad hoc and not root, apply the child defaults if ((queue.getParent() != null) && !configuredLeafQueues.contains(queue.getName()) && !configuredParentQueues.contains(queue.getName())) { ConfigurableResource max = queue.getParent(). getMaxChildQueueResource(); if (max != null) { queue.setMaxShare(max); } } } }
/** * Removes all empty dynamic queues (including empty dynamic parent queues). */ public void removeEmptyDynamicQueues() { synchronized (queues) { Set<FSParentQueue> parentQueuesToCheck = new HashSet<>(); for (FSQueue queue : getQueues()) { if (queue.isDynamic() && queue.getChildQueues().isEmpty()) { boolean removed = removeQueueIfEmpty(queue); if (removed && queue.getParent().isDynamic()) { parentQueuesToCheck.add(queue.getParent()); } } } while (!parentQueuesToCheck.isEmpty()) { FSParentQueue queue = parentQueuesToCheck.iterator().next(); if (queue.getChildQueues().isEmpty()) { removeQueue(queue); if (queue.getParent().isDynamic()) { parentQueuesToCheck.add(queue.getParent()); } } parentQueuesToCheck.remove(queue); } } }
/** * Checks whether making the application runnable would exceed any * maxRunningApps limits. */ public boolean canAppBeRunnable(FSQueue queue, String user) { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); Integer userNumRunnable = usersNumRunnableApps.get(user); if (userNumRunnable == null) { userNumRunnable = 0; } if (userNumRunnable >= allocConf.getUserMaxApps(user)) { return false; } // Check queue and all parent queues while (queue != null) { int queueMaxApps = allocConf.getQueueMaxApps(queue.getName()); if (queue.getNumRunnableApps() >= queueMaxApps) { return false; } queue = queue.getParent(); } return true; }
/** * Checks whether making the application runnable would exceed any * maxRunningApps limits. */ public boolean canAppBeRunnable(FSQueue queue, String user) { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); Integer userNumRunnable = usersNumRunnableApps.get(user); if (userNumRunnable == null) { userNumRunnable = 0; } if (userNumRunnable >= allocConf.getUserMaxApps(user)) { return false; } // Check queue and all parent queues while (queue != null) { int queueMaxApps = allocConf.getQueueMaxApps(queue.getName()); if (queue.getNumRunnableApps() >= queueMaxApps) { return false; } queue = queue.getParent(); } return true; }
boolean fitsInMaxShare(Resource additionalResource) { Resource usagePlusAddition = Resources.add(getResourceUsage(), additionalResource); if (!Resources.fitsIn(usagePlusAddition, getMaxShare())) { if (LOG.isDebugEnabled()) { LOG.debug("Resource usage plus resource request: " + usagePlusAddition + " exceeds maximum resource allowed:" + getMaxShare() + " in queue " + getName()); } return false; } FSQueue parentQueue = getParent(); if (parentQueue != null) { return parentQueue.fitsInMaxShare(additionalResource); } return true; }
static boolean fitsInMaxShare(FSQueue queue, Resource additionalResource) { Resource usagePlusAddition = Resources.add(queue.getResourceUsage(), additionalResource); if (!Resources.fitsIn(usagePlusAddition, queue.getMaxShare())) { return false; } FSQueue parentQueue = queue.getParent(); if (parentQueue != null) { return fitsInMaxShare(parentQueue, additionalResource); } return true; }
static boolean fitsInMaxShare(FSQueue queue, Resource additionalResource) { Resource usagePlusAddition = Resources.add(queue.getResourceUsage(), additionalResource); if (!Resources.fitsIn(usagePlusAddition, queue.getMaxShare())) { return false; } FSQueue parentQueue = queue.getParent(); if (parentQueue != null) { return fitsInMaxShare(parentQueue, additionalResource); } return true; }
return null; if (!queue.getParent().getQueueName().equals(queueName)) { String message = "Application: " + applicationId + " submitted to a reservation "
return null; if (!queue.getParent().getQueueName().equals(queueName)) { String message = "Application: " + applicationId + " submitted to a reservation "
return null; if (!queue.getParent().getQueueName().equals(queueName)) { String message = "Application: " + applicationId + " submitted to a reservation "