/// <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);
        }
Esempio n. 2
0
 /// <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);
 }