if (null == newQueue) { if (oldQueue.getState() == QueueState.STOPPED) { LOG.info("Deleting Queue " + queueName + ", as it is not" + " present in the modified capacity configuration xml"); + " the new capacity scheduler configuration, but the" + " queue is not yet in stopped state. " + "Current State : " + oldQueue.getState()); } else if (oldQueue instanceof LeafQueue && newQueue instanceof ParentQueue) { if (oldQueue.getState() == QueueState.STOPPED) { LOG.info("Converting the leaf queue: " + oldQueue.getQueuePath() + " to parent queue."); + " to parent queue since " + "it is not yet in stopped state. Current State : " + oldQueue.getState());
public void recoverDrainingState() { try { this.writeLock.lock(); if (getState() == QueueState.STOPPED) { updateQueueState(QueueState.DRAINING); } LOG.info("Recover draining state for queue " + this.getQueuePath()); if (getParent() != null && getParent().getState() == QueueState.STOPPED) { ((AbstractCSQueue) getParent()).recoverDrainingState(); } } finally { this.writeLock.unlock(); } }
@Override public void activeQueue() throws YarnException { try { this.writeLock.lock(); if (getState() == QueueState.RUNNING) { LOG.info("The specified queue:" + queueName + " is already in the RUNNING state."); } else if (getState() == QueueState.DRAINING) { throw new YarnException( "The queue:" + queueName + " is in the Stopping process. " + "Please wait for the queue getting fully STOPPED."); } else { CSQueue parent = getParent(); if (parent == null || parent.getState() == QueueState.RUNNING) { updateQueueState(QueueState.RUNNING); } else { throw new YarnException("The parent Queue:" + parent.getQueueName() + " is not running. Please activate the parent queue first"); } } } finally { this.writeLock.unlock(); } }
if (queue.getState() == QueueState.STOPPED) { ((LeafQueue) queue).recoverDrainingState();
CapacitySchedulerQueueInfo(final CSQueue q, final String nodeLabel) { QueueCapacities qCapacities = q.getQueueCapacities(); ResourceUsage queueResourceUsage = q.getQueueResourceUsage(); queuePath = q.getQueuePath(); capacity = qCapacities.getCapacity(nodeLabel) * 100; usedCapacity = q.getUsedCapacity(nodeLabel) * 100; maxCapacity = qCapacities.getMaximumCapacity(nodeLabel); if (maxCapacity < EPSILON || maxCapacity > 1f) maxCapacity = 1f; maxCapacity *= 100; absoluteCapacity = cap(qCapacities.getAbsoluteCapacity(nodeLabel), 0f, 1f) * 100; absoluteMaxCapacity = cap(qCapacities.getAbsoluteMaximumCapacity(nodeLabel), 0f, 1f) * 100; absoluteUsedCapacity = q.getAbsoluteUsedCapacity(nodeLabel) * 100; numApplications = q.getNumApplications(); queueName = q.getQueueName(); state = q.getState(); resourcesUsed = new ResourceInfo(queueResourceUsage.getUsed(nodeLabel)); if (q instanceof PlanQueue && !((PlanQueue) q).showReservationsAsQueues()) { hideReservationQueues = true; } // add labels Set<String> labelSet = q.getAccessibleNodeLabels(); if (labelSet != null) { nodeLabels.addAll(labelSet); Collections.sort(nodeLabels); } }
QueueState configuredState = configuration .getConfiguredState(getQueuePath()); QueueState parentState = (parent == null) ? null : parent.getState(); initializeQueueState(previous, configuredState, parentState);
CapacitySchedulerQueueInfo(final CSQueue q, final String nodeLabel) { QueueCapacities qCapacities = q.getQueueCapacities(); ResourceUsage queueResourceUsage = q.getQueueResourceUsage(); queuePath = q.getQueuePath(); capacity = qCapacities.getCapacity(nodeLabel) * 100; usedCapacity = q.getUsedCapacity(nodeLabel) * 100; maxCapacity = qCapacities.getMaximumCapacity(nodeLabel); if (maxCapacity < EPSILON || maxCapacity > 1f) maxCapacity = 1f; maxCapacity *= 100; absoluteCapacity = cap(qCapacities.getAbsoluteCapacity(nodeLabel), 0f, 1f) * 100; absoluteMaxCapacity = cap(qCapacities.getAbsoluteMaximumCapacity(nodeLabel), 0f, 1f) * 100; absoluteUsedCapacity = q.getAbsoluteUsedCapacity(nodeLabel) * 100; numApplications = q.getNumApplications(); queueName = q.getQueueName(); state = q.getState(); resourcesUsed = new ResourceInfo(queueResourceUsage.getUsed(nodeLabel)); if (q instanceof PlanQueue && !((PlanQueue) q).showReservationsAsQueues()) { hideReservationQueues = true; } // add labels Set<String> labelSet = q.getAccessibleNodeLabels(); if (labelSet != null) { nodeLabels.addAll(labelSet); Collections.sort(nodeLabels); } }
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q3).getState()); conf = new YarnConfiguration(csConf); cs.reinitialize(conf, rmContext); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.DRAINING, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q3).getState()); conf = new YarnConfiguration(csConf); cs.reinitialize(conf, rmContext); Assert.assertEquals(QueueState.DRAINING, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.DRAINING, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q3).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q3).getState());
when(bQueue.getState()).thenReturn(QueueState.DRAINING) .thenReturn(QueueState.STOPPED); queues.put("b", bQueue); when(bQueue.getState()).thenReturn(QueueState.STOPPED); queues.put("b1", bQueue); when(bQueue.getState()).thenReturn(QueueState.STOPPED); queues.put("b2", bQueue); when(bQueue.getState()).thenReturn(QueueState.STOPPED); queues.put("b3", bQueue);
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q3).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q3).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q3).getState()); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q3).getState()); stateManager.stopQueue(Q1); Assert.assertEquals(QueueState.DRAINING, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.DRAINING, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q3).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q2).getState());
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q2).getState()); cs.reinitialize(conf, rmContext); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q1).getState()); Assert.assertEquals(QueueState.STOPPED, cs.getQueue(Q2).getState());
reservedContainers = q.getMetrics().getReservedContainers(); queueName = q.getQueueName(); state = q.getState(); resourcesUsed = new ResourceInfo(q.getUsedResources()); if (q instanceof PlanQueue && !((PlanQueue) q).showReservationsAsQueues()) {
capacityScheduler.getQueue(Q2).getState()); Assert.assertEquals(QueueState.DRAINING, capacityScheduler.getQueue(Q1).getState()); capacityScheduler = (CapacityScheduler) rm.getRMContext().getScheduler(); Assert.assertEquals(QueueState.DRAINING, capacityScheduler.getQueue(Q2).getState()); Assert.assertEquals(QueueState.DRAINING, capacityScheduler.getQueue(Q1).getState());
Assert.assertEquals(QueueState.RUNNING, b1.getState()); conf.set("yarn.scheduler.capacity.root.b.b1.state", "STOPPED"); cs.reinitialize(conf, mockContext); Assert.assertEquals(QueueState.STOPPED, b1.getState()); Assert.assertEquals(QueueState.RUNNING, b1.getState()); Assert.assertTrue(!b1.getChildQueues().isEmpty());