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; }
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(); }