@Override public void stopQueue() { try { this.writeLock.lock(); if (getNumApplications() > 0) { updateQueueState(QueueState.DRAINING); } else { updateQueueState(QueueState.STOPPED); } if (getChildQueues() != null) { for(CSQueue child : getChildQueues()) { child.stopQueue(); } } } finally { this.writeLock.unlock(); } }
ParentQueue mockParentQueue(ParentQueue p, int subqueues, Deque<ParentQueue> pqs) { ParentQueue pq = mock(ParentQueue.class); List<CSQueue> cqs = new ArrayList<CSQueue>(); when(pq.getChildQueues()).thenReturn(cqs); for (int i = 0; i < subqueues; ++i) { pqs.add(pq); } if (p != null) { p.getChildQueues().add(pq); } return pq; }
ParentQueue mockParentQueue(ParentQueue p, int subqueues, Deque<ParentQueue> pqs) { ParentQueue pq = mock(ParentQueue.class); List<CSQueue> cqs = new ArrayList<CSQueue>(); when(pq.getChildQueues()).thenReturn(cqs); ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); when(pq.getReadLock()).thenReturn(lock.readLock()); // Ordering policy QueueOrderingPolicy policy = mock(QueueOrderingPolicy.class); when(policy.getConfigName()).thenReturn( CapacitySchedulerConfiguration.QUEUE_PRIORITY_UTILIZATION_ORDERING_POLICY); when(pq.getQueueOrderingPolicy()).thenReturn(policy); when(pq.getPriority()).thenReturn(Priority.newInstance(0)); for (int i = 0; i < subqueues; ++i) { pqs.add(pq); } if (p != null) { p.getChildQueues().add(pq); } return pq; }
queue = parentQueue; List<CSQueue> children = new ArrayList<CSQueue>(); when(parentQueue.getChildQueues()).thenReturn(children); QueueOrderingPolicy policy = mock(QueueOrderingPolicy.class); when(policy.getConfigName()).thenReturn(
when(lq.getMaxAMResourcePerQueuePercent()).thenReturn(setAMResourcePercent); p.getChildQueues().add(lq); return lq;
when(lq.getReadLock()).thenReturn(lock.readLock()); when(lq.getPriority()).thenReturn(Priority.newInstance(0)); p.getChildQueues().add(lq); return lq;
if (null != parentQueue) { when(queue.getParent()).thenReturn(parentQueue); parentQueue.getChildQueues().add(queue);
void printString(CSQueue nq, String indent) { if (nq instanceof ParentQueue) { System.out.println(indent + nq.getQueueName() + " cur:" + nq.getAbsoluteUsedCapacity() + " guar:" + nq.getAbsoluteCapacity() ); for (CSQueue q : ((ParentQueue)nq).getChildQueues()) { printString(q, indent + " "); } } else { System.out.println(indent + nq.getQueueName() + " pen:" + ((LeafQueue) nq) .getTotalPendingResourcesConsideringUserLimit(isA(Resource.class)) + " cur:" + nq.getAbsoluteUsedCapacity() + " guar:" + nq.getAbsoluteCapacity() ); for (FiCaSchedulerApp a : ((LeafQueue)nq).getApplications()) { System.out.println(indent + " " + a.getApplicationId()); } } }
for (CSQueue childQueue : getChildQueues()) { Resources.addTo(configuredMinResources, childQueue.getQueueResourceQuotas().getConfiguredMinResource(label)); for (CSQueue childQueue : getChildQueues()) { Resource minResource = childQueue.getQueueResourceQuotas() .getConfiguredMinResource(label);
csConf.setCapacity(CapacitySchedulerConfiguration.ROOT + ".b.b4", 0f); ParentQueue bQ = (ParentQueue) capacityScheduler.getQueue("b"); checkEqualsToQueueSet(bQ.getChildQueues(), new String[] { "b1", "b2", "b3" }); capacityScheduler.reinitialize(new YarnConfiguration(csConf), rmContext); checkEqualsToQueueSet(bQ.getChildQueues(), new String[] { "b1", "b2", "b3", "b4" });