Exemplo n.º 1
0
 public FSQueue(string name, FairScheduler scheduler, FSParentQueue parent)
 {
     this.name      = name;
     this.scheduler = scheduler;
     this.metrics   = ((FSQueueMetrics)FSQueueMetrics.ForQueue(GetName(), parent, true,
                                                               scheduler.GetConf()));
     metrics.SetMinShare(GetMinShare());
     metrics.SetMaxShare(GetMaxShare());
     this.parent = parent;
 }
Exemplo n.º 2
0
        public virtual void SetUp()
        {
            conf = new FairSchedulerConfiguration();
            FairScheduler           scheduler = Org.Mockito.Mockito.Mock <FairScheduler>();
            AllocationConfiguration allocConf = new AllocationConfiguration(conf);

            Org.Mockito.Mockito.When(scheduler.GetAllocationConfiguration()).ThenReturn(allocConf
                                                                                        );
            Org.Mockito.Mockito.When(scheduler.GetConf()).ThenReturn(conf);
            SystemClock clock = new SystemClock();

            Org.Mockito.Mockito.When(scheduler.GetClock()).ThenReturn(clock);
            notEmptyQueues = new HashSet <FSQueue>();
            queueManager   = new _QueueManager_47(this, scheduler);
            FSQueueMetrics.ForQueue("root", null, true, conf);
            queueManager.Initialize(conf);
        }
Exemplo n.º 3
0
 public virtual void UpdateAllocationConfiguration(AllocationConfiguration queueConf
                                                   )
 {
     // Create leaf queues and the parent queues in a leaf's ancestry if they do not exist
     foreach (string name in queueConf.GetConfiguredQueues()[FSQueueType.Leaf])
     {
         if (RemoveEmptyIncompatibleQueues(name, FSQueueType.Leaf))
         {
             GetLeafQueue(name, true);
         }
     }
     // At this point all leaves and 'parents with at least one child' would have been created.
     // Now create parents with no configured leaf.
     foreach (string name_1 in queueConf.GetConfiguredQueues()[FSQueueType.Parent])
     {
         if (RemoveEmptyIncompatibleQueues(name_1, FSQueueType.Parent))
         {
             GetParentQueue(name_1, true);
         }
     }
     foreach (FSQueue queue in queues.Values)
     {
         // Update queue metrics
         FSQueueMetrics queueMetrics = queue.GetMetrics();
         queueMetrics.SetMinShare(queue.GetMinShare());
         queueMetrics.SetMaxShare(queue.GetMaxShare());
         // Set scheduling policies
         try
         {
             SchedulingPolicy policy = queueConf.GetSchedulingPolicy(queue.GetName());
             policy.Initialize(scheduler.GetClusterResource());
             queue.SetPolicy(policy);
         }
         catch (AllocationConfigurationException ex)
         {
             Log.Warn("Cannot apply configured scheduling policy to queue " + queue.GetName(),
                      ex);
         }
     }
     // Update steady fair shares for all queues
     rootQueue.RecomputeSteadyShares();
     // Update the fair share preemption timeouts and preemption for all queues
     // recursively
     rootQueue.UpdatePreemptionVariables();
 }