Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns true if there are no applications, running or not, in the given
 /// queue or any of its descendents.
 /// </summary>
 protected internal virtual bool IsEmpty(FSQueue queue)
 {
     if (queue is FSLeafQueue)
     {
         FSLeafQueue leafQueue = (FSLeafQueue)queue;
         return(queue.GetNumRunnableApps() == 0 && leafQueue.GetNumNonRunnableApps() == 0);
     }
     else
     {
         foreach (FSQueue child in queue.GetChildQueues())
         {
             if (!IsEmpty(child))
             {
                 return(false);
             }
         }
         return(true);
     }
 }
Ejemplo n.º 3
0
 /// <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);
             }
         }
     }
 }