internal CapacitySchedulerQueueInfo(CSQueue q) { queuePath = q.GetQueuePath(); capacity = q.GetCapacity() * 100; usedCapacity = q.GetUsedCapacity() * 100; maxCapacity = q.GetMaximumCapacity(); if (maxCapacity < Epsilon || maxCapacity > 1f) { maxCapacity = 1f; } maxCapacity *= 100; absoluteCapacity = Cap(q.GetAbsoluteCapacity(), 0f, 1f) * 100; absoluteMaxCapacity = Cap(q.GetAbsoluteMaximumCapacity(), 0f, 1f) * 100; absoluteUsedCapacity = Cap(q.GetAbsoluteUsedCapacity(), 0f, 1f) * 100; numApplications = q.GetNumApplications(); queueName = q.GetQueueName(); state = q.GetState(); resourcesUsed = new ResourceInfo(q.GetUsedResources()); if (q is PlanQueue && !((PlanQueue)q).ShowReservationsAsQueues()) { hideReservationQueues = true; } // add labels ICollection <string> labelSet = q.GetAccessibleNodeLabels(); if (labelSet != null) { Sharpen.Collections.AddAll(nodeLabels, labelSet); nodeLabels.Sort(); } }
protected internal override void AssertReservationQueueExists(ReservationId r2, double expectedCapacity, double expectedMaxCapacity) { CSQueue q = cs.GetQueue(r2.ToString()); NUnit.Framework.Assert.IsNotNull(q); NUnit.Framework.Assert.AreEqual(expectedCapacity, q.GetCapacity(), 0.01); NUnit.Framework.Assert.AreEqual(expectedMaxCapacity, q.GetMaximumCapacity(), 1.0); }
public CapacitySchedulerInfo(CSQueue parent) { // JAXB needs this this.queueName = parent.GetQueueName(); this.usedCapacity = parent.GetUsedCapacity() * 100; this.capacity = parent.GetCapacity() * 100; float max = parent.GetMaximumCapacity(); if (max < Epsilon || max > 1f) { max = 1f; } this.maxCapacity = max * 100; queues = GetQueues(parent); }
/// <exception cref="Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Scheduler.SchedulerDynamicEditException /// "/> internal virtual void AddChildQueue(CSQueue newQueue) { lock (this) { if (newQueue.GetCapacity() > 0) { throw new SchedulerDynamicEditException("Queue " + newQueue + " being added has non zero capacity." ); } bool added = this.childQueues.AddItem(newQueue); if (Log.IsDebugEnabled()) { Log.Debug("updateChildQueues (action: add queue): " + added + " " + GetChildQueuesToPrint ()); } } }
private void CheckQueueLabels(CapacityScheduler capacityScheduler) { // queue-A is red, blue NUnit.Framework.Assert.IsTrue(capacityScheduler.GetQueue("a").GetAccessibleNodeLabels ().ContainsAll(ImmutableSet.Of("red", "blue"))); // queue-A1 inherits A's configuration NUnit.Framework.Assert.IsTrue(capacityScheduler.GetQueue("a1").GetAccessibleNodeLabels ().ContainsAll(ImmutableSet.Of("red", "blue"))); // queue-A2 is "red" NUnit.Framework.Assert.AreEqual(1, capacityScheduler.GetQueue("a2").GetAccessibleNodeLabels ().Count); NUnit.Framework.Assert.IsTrue(capacityScheduler.GetQueue("a2").GetAccessibleNodeLabels ().Contains("red")); // queue-B is "red"/"blue" NUnit.Framework.Assert.IsTrue(capacityScheduler.GetQueue("b").GetAccessibleNodeLabels ().ContainsAll(ImmutableSet.Of("red", "blue"))); // queue-B2 inherits "red"/"blue" NUnit.Framework.Assert.IsTrue(capacityScheduler.GetQueue("b2").GetAccessibleNodeLabels ().ContainsAll(ImmutableSet.Of("red", "blue"))); // check capacity of A2 CSQueue qA2 = capacityScheduler.GetQueue("a2"); NUnit.Framework.Assert.AreEqual(0.7, qA2.GetCapacity(), Delta); NUnit.Framework.Assert.AreEqual(0.5, qA2.GetQueueCapacities().GetCapacity("red"), Delta); NUnit.Framework.Assert.AreEqual(0.07, qA2.GetAbsoluteCapacity(), Delta); NUnit.Framework.Assert.AreEqual(0.25, qA2.GetQueueCapacities().GetAbsoluteCapacity ("red"), Delta); NUnit.Framework.Assert.AreEqual(0.1275, qA2.GetAbsoluteMaximumCapacity(), Delta); NUnit.Framework.Assert.AreEqual(0.3, qA2.GetQueueCapacities().GetAbsoluteMaximumCapacity ("red"), Delta); // check capacity of B3 CSQueue qB3 = capacityScheduler.GetQueue("b3"); NUnit.Framework.Assert.AreEqual(0.18, qB3.GetAbsoluteCapacity(), Delta); NUnit.Framework.Assert.AreEqual(0.125, qB3.GetQueueCapacities().GetAbsoluteCapacity ("red"), Delta); NUnit.Framework.Assert.AreEqual(0.35, qB3.GetAbsoluteMaximumCapacity(), Delta); NUnit.Framework.Assert.AreEqual(1, qB3.GetQueueCapacities().GetAbsoluteMaximumCapacity ("red"), Delta); }
/// <exception cref="Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Scheduler.SchedulerDynamicEditException /// "/> internal virtual void RemoveChildQueue(CSQueue remQueue) { lock (this) { if (remQueue.GetCapacity() > 0) { throw new SchedulerDynamicEditException("Queue " + remQueue + " being removed has non zero capacity." ); } IEnumerator <CSQueue> qiter = childQueues.GetEnumerator(); while (qiter.HasNext()) { CSQueue cs = qiter.Next(); if (cs.Equals(remQueue)) { qiter.Remove(); if (Log.IsDebugEnabled()) { Log.Debug("Removed child queue: {}", cs.GetQueueName()); } } } } }
protected internal override void VerifyCapacity(Queue defQ) { CSQueue csQueue = (CSQueue)defQ; NUnit.Framework.Assert.IsTrue(csQueue.GetCapacity() > 0.9); }