/// <summary> /// Checks whether making the application runnable would exceed any /// maxRunningApps limits. /// </summary> public virtual bool CanAppBeRunnable(FSQueue queue, string user) { AllocationConfiguration allocConf = scheduler.GetAllocationConfiguration(); int userNumRunnable = usersNumRunnableApps[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); }
/// <summary>Remove a queue and all its descendents.</summary> private void RemoveQueue(FSQueue queue) { if (queue is FSLeafQueue) { leafQueues.Remove(queue); } else { IList <FSQueue> childQueues = queue.GetChildQueues(); while (!childQueues.IsEmpty()) { RemoveQueue(childQueues[0]); } } Sharpen.Collections.Remove(queues, queue.GetName()); queue.GetParent().GetChildQueues().Remove(queue); }
/// <summary> /// Traverses the queue hierarchy under the given queue to gather all lists /// of non-runnable applications. /// </summary> private void GatherPossiblyRunnableAppLists(FSQueue queue, IList <IList <FSAppAttempt > > appLists) { if (queue.GetNumRunnableApps() < scheduler.GetAllocationConfiguration().GetQueueMaxApps (queue.GetName())) { if (queue is FSLeafQueue) { appLists.AddItem(((FSLeafQueue)queue).GetCopyOfNonRunnableAppSchedulables()); } else { foreach (FSQueue child in queue.GetChildQueues()) { GatherPossiblyRunnableAppLists(child, appLists); } } } }