@Override public String toString() { return "QueueManagementChange{" + "queue=" + queue.getQueueName() + ", updatedEntitlementsByPartition=" + queueTemplateUpdate + ", queueAction=" + queueAction + ", transitionToQueueState=" + transitionToQueueState + '}'; }
private Map<String, CSQueue> getQueuesMap(List<CSQueue> queues) { Map<String, CSQueue> queuesMap = new HashMap<String, CSQueue>(); for (CSQueue queue : queues) { queuesMap.put(queue.getQueueName(), queue); } return queuesMap; }
Map<String, CSQueue> getQueues(Set<CSQueue> queues) { Map<String, CSQueue> queuesMap = new HashMap<String, CSQueue>(); for (CSQueue queue : queues) { queuesMap.put(queue.getQueueName(), queue); } return queuesMap; }
Map<String, CSQueue> getQueues(Set<CSQueue> queues) { Map<String, CSQueue> queuesMap = new HashMap<String, CSQueue>(); for (CSQueue queue : queues) { queuesMap.put(queue.getQueueName(), queue); } return queuesMap; }
private static void validateQueueMappingUnderParentQueue(CSQueue parentQueue, String parentQueueName, String leafQueueName) throws IOException { if (parentQueue == null) { throw new IOException( "mapping contains invalid or non-leaf queue [" + leafQueueName + "] and invalid parent queue [" + parentQueueName + "]"); } else if (!(parentQueue instanceof ManagedParentQueue)) { throw new IOException("mapping contains leaf queue [" + leafQueueName + "] and invalid parent queue which " + "does not have auto creation of leaf queues enabled [" + parentQueueName + "]"); } else if (!parentQueue.getQueueName().equals(parentQueueName)) { throw new IOException( "mapping contains invalid or non-leaf queue [" + leafQueueName + "] and invalid parent queue " + "which does not match existing leaf queue's parent : [" + parentQueueName + "] does not match [ " + parentQueue .getQueueName() + "]"); } }
private Map<String, Set<String>> getQueueToLabels() { Map<String, Set<String>> queueToLabels = new HashMap<String, Set<String>>(); for (CSQueue queue : queues.values()) { queueToLabels.put(queue.getQueueName(), queue.getAccessibleNodeLabels()); } return queueToLabels; }
private Map<String, Set<String>> getQueueToLabels() { Map<String, Set<String>> queueToLabels = new HashMap<String, Set<String>>(); for (CSQueue queue : queues.values()) { queueToLabels.put(queue.getQueueName(), queue.getAccessibleNodeLabels()); } return queueToLabels; }
/** * Get a map of queueToLabels. * @return the map of queueToLabels */ private Map<String, Set<String>> getQueueToLabels() { Map<String, Set<String>> queueToLabels = new HashMap<>(); for (CSQueue queue : getQueues().values()) { queueToLabels.put(queue.getQueueName(), queue.getAccessibleNodeLabels()); } return queueToLabels; }
synchronized void removeChildQueue(CSQueue remQueue) throws SchedulerDynamicEditException { if (remQueue.getCapacity() > 0) { throw new SchedulerDynamicEditException("Queue " + remQueue + " being removed has non zero capacity."); } Iterator<CSQueue> qiter = childQueues.iterator(); while (qiter.hasNext()) { CSQueue cs = qiter.next(); if (cs.equals(remQueue)) { qiter.remove(); if (LOG.isDebugEnabled()) { LOG.debug("Removed child queue: {}", cs.getQueueName()); } } } }
synchronized void removeChildQueue(CSQueue remQueue) throws SchedulerDynamicEditException { if (remQueue.getCapacity() > 0) { throw new SchedulerDynamicEditException("Queue " + remQueue + " being removed has non zero capacity."); } Iterator<CSQueue> qiter = childQueues.iterator(); while (qiter.hasNext()) { CSQueue cs = qiter.next(); if (cs.equals(remQueue)) { qiter.remove(); if (LOG.isDebugEnabled()) { LOG.debug("Removed child queue: {}", cs.getQueueName()); } } } }
private String getParentName() { return getParent() != null ? getParent().getQueueName() : ""; }
private int getNumAppsInQueue(String name, List<CSQueue> queues) { for (CSQueue queue : queues) { if (queue.getQueueName().equals(name)) { return queue.getNumApplications(); } } return -1; }
private int getNumAppsInQueue(String name, List<CSQueue> queues) { for (CSQueue queue : queues) { if (queue.getQueueName().equals(name)) { return queue.getNumApplications(); } } return -1; }
@Override public void reinitialize(CSQueue newlyParsedQueue, Resource clusterResource) throws IOException { try { writeLock.lock(); validate(newlyParsedQueue); ManagedParentQueue managedParentQueue = (ManagedParentQueue) parent; super.reinitialize(newlyParsedQueue, clusterResource, managedParentQueue .getLeafQueueConfigs(newlyParsedQueue.getQueueName())); //Reset capacities to 0 since reinitialize above // queueCapacities to initialize to configured capacity which might // overcommit resources from parent queue updateCapacitiesToZero(); } finally { writeLock.unlock(); } }
private void checkEqualsToQueueSet(List<CSQueue> queues, String[] queueNames) { Set<String> existedQueues = new HashSet<>(); for (CSQueue q : queues) { existedQueues.add(q.getQueueName()); } for (String q : queueNames) { Assert.assertTrue(existedQueues.remove(q)); } Assert.assertTrue(existedQueues.isEmpty()); } }
private void verifyOrder(QueueOrderingPolicy orderingPolicy, String partition, String[] expectedOrder) { Iterator<CSQueue> iter = orderingPolicy.getAssignmentIterator(partition); int i = 0; while (iter.hasNext()) { CSQueue q = iter.next(); Assert.assertEquals(expectedOrder[i], q.getQueueName()); i++; } assert i == expectedOrder.length; }
public CapacitySchedulerInfo(final CSQueue parent, final NodeLabel nodeLabel) { String label = nodeLabel.getLabelName(); QueueCapacities parentQueueCapacities = parent.getQueueCapacities(); this.queueName = parent.getQueueName(); this.usedCapacity = parent.getUsedCapacity(label) * 100; this.capacity = parentQueueCapacities.getCapacity(label) * 100; float max = parentQueueCapacities.getMaximumCapacity(label); if (max < EPSILON || max > 1f) max = 1f; this.maxCapacity = max * 100; queues = getQueues(parent, nodeLabel); }
public CapacitySchedulerInfo(final CSQueue parent, final NodeLabel nodeLabel) { String label = nodeLabel.getLabelName(); QueueCapacities parentQueueCapacities = parent.getQueueCapacities(); this.queueName = parent.getQueueName(); this.usedCapacity = parent.getUsedCapacity(label) * 100; this.capacity = parentQueueCapacities.getCapacity(label) * 100; float max = parentQueueCapacities.getMaximumCapacity(label); if (max < EPSILON || max > 1f) max = 1f; this.maxCapacity = max * 100; queues = getQueues(parent, nodeLabel); }
public CapacitySchedulerInfo(CSQueue parent, CapacityScheduler cs) { 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; capacities = new QueueCapacitiesInfo(parent.getQueueCapacities(), parent.getQueueResourceQuotas(), false); queues = getQueues(parent); health = new CapacitySchedulerHealthInfo(cs); }
protected ApplicationId submitApp(MockRM rm, CSQueue parentQueue, String leafQueueName, String user, int expectedNumAppsInParentQueue, int expectedNumAppsInLeafQueue) throws Exception { CapacityScheduler capacityScheduler = (CapacityScheduler) rm.getResourceScheduler(); // submit an app RMApp rmApp = rm.submitApp(GB, "test-auto-queue-activation", user, null, leafQueueName); // check preconditions List<ApplicationAttemptId> appsInParentQueue = capacityScheduler.getAppsInQueue(parentQueue.getQueueName()); assertEquals(expectedNumAppsInParentQueue, appsInParentQueue.size()); List<ApplicationAttemptId> appsInLeafQueue = capacityScheduler.getAppsInQueue(leafQueueName); assertEquals(expectedNumAppsInLeafQueue, appsInLeafQueue.size()); return rmApp.getApplicationId(); }