コード例 #1
0
 /// <exception cref="System.IO.IOException"/>
 public override void Reinitialize(CSQueue newlyParsedQueue, Resource clusterResource
                                   )
 {
     lock (this)
     {
         // Sanity check
         if (!(newlyParsedQueue is Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Scheduler.Capacity.ParentQueue
               ) || !newlyParsedQueue.GetQueuePath().Equals(GetQueuePath()))
         {
             throw new IOException("Trying to reinitialize " + GetQueuePath() + " from " + newlyParsedQueue
                                   .GetQueuePath());
         }
         Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Scheduler.Capacity.ParentQueue newlyParsedParentQueue
             = (Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Scheduler.Capacity.ParentQueue
                )newlyParsedQueue;
         // Set new configs
         SetupQueueConfigs(clusterResource);
         // Re-configure existing child queues and add new ones
         // The CS has already checked to ensure all existing child queues are present!
         IDictionary <string, CSQueue> currentChildQueues = GetQueues(childQueues);
         IDictionary <string, CSQueue> newChildQueues     = GetQueues(newlyParsedParentQueue.childQueues
                                                                      );
         foreach (KeyValuePair <string, CSQueue> e in newChildQueues)
         {
             string  newChildQueueName = e.Key;
             CSQueue newChildQueue     = e.Value;
             CSQueue childQueue        = currentChildQueues[newChildQueueName];
             // Check if the child-queue already exists
             if (childQueue != null)
             {
                 // Re-init existing child queues
                 childQueue.Reinitialize(newChildQueue, clusterResource);
                 Log.Info(GetQueueName() + ": re-configured queue: " + childQueue);
             }
             else
             {
                 // New child queue, do not re-init
                 // Set parent to 'this'
                 newChildQueue.SetParent(this);
                 // Save in list of current child queues
                 currentChildQueues[newChildQueueName] = newChildQueue;
                 Log.Info(GetQueueName() + ": added new child queue: " + newChildQueue);
             }
         }
         // Re-sort all queues
         childQueues.Clear();
         Sharpen.Collections.AddAll(childQueues, currentChildQueues.Values);
     }
 }