/** * Updates to our list of queues: Adds the new queues and deletes the removed * ones... be careful, do not overwrite existing queues. * * @param existingQueues, the existing queues * @param newQueues the new queues based on new XML */ private void updateQueues(Map<String, CSQueue> existingQueues, Map<String, CSQueue> newQueues) { CapacitySchedulerConfiguration conf = csContext.getConfiguration(); for (Map.Entry<String, CSQueue> e : newQueues.entrySet()) { String queueName = e.getKey(); CSQueue queue = e.getValue(); if (!existingQueues.containsKey(queueName)) { existingQueues.put(queueName, queue); } } for (Iterator<Map.Entry<String, CSQueue>> itr = existingQueues.entrySet() .iterator(); itr.hasNext();) { Map.Entry<String, CSQueue> e = itr.next(); String queueName = e.getKey(); CSQueue existingQueue = e.getValue(); if (!newQueues.containsKey(queueName) && !( existingQueue instanceof AutoCreatedLeafQueue && conf .isAutoCreateChildQueueEnabled( existingQueue.getParent().getQueuePath()))) { itr.remove(); } } }
public static QueueMappingEntity validateAndGetQueueMapping( CapacitySchedulerQueueManager queueManager, CSQueue queue, QueueMappingEntity mapping, QueuePath queuePath) throws IOException { if (!(queue instanceof LeafQueue)) { throw new IOException( "mapping contains invalid or non-leaf queue : " + mapping.getQueue()); } if (queue instanceof AutoCreatedLeafQueue && queue .getParent() instanceof ManagedParentQueue) { QueueMappingEntity newMapping = validateAndGetAutoCreatedQueueMapping( queueManager, mapping, queuePath); if (newMapping == null) { throw new IOException( "mapping contains invalid or non-leaf queue " + mapping.getQueue()); } return newMapping; } return mapping; }
private static QueueMapping validateAndGetQueueMapping( CapacitySchedulerQueueManager queueManager, CSQueue queue, QueueMapping mapping, QueuePath queuePath) throws IOException { if (!(queue instanceof LeafQueue)) { throw new IOException( "mapping contains invalid or non-leaf queue : " + mapping.getQueue()); } if (queue instanceof AutoCreatedLeafQueue && queue .getParent() instanceof ManagedParentQueue) { QueueMapping newMapping = validateAndGetAutoCreatedQueueMapping( queueManager, mapping, queuePath); if (newMapping == null) { throw new IOException( "mapping contains invalid or non-leaf queue " + mapping.getQueue()); } return newMapping; } return mapping; }
public void validateQueueManagementChanges( List<QueueManagementChange> queueManagementChanges) throws SchedulerDynamicEditException { for (QueueManagementChange queueManagementChange : queueManagementChanges) { CSQueue childQueue = queueManagementChange.getQueue(); if (!(childQueue instanceof AutoCreatedLeafQueue)) { throw new SchedulerDynamicEditException( "queue should be " + "AutoCreatedLeafQueue. Found " + childQueue .getClass()); } if (!(AbstractManagedParentQueue.class. isAssignableFrom(childQueue.getParent().getClass()))) { LOG.error("Queue " + getQueueName() + " is not an instance of PlanQueue or ManagedParentQueue." + " " + "Ignoring update " + queueManagementChanges); throw new SchedulerDynamicEditException( "Queue " + getQueueName() + " is not a AutoEnabledParentQueue." + " Ignoring update " + queueManagementChanges); } switch (queueManagementChange.getQueueAction()){ case UPDATE_QUEUE: AutoCreatedLeafQueueConfig template = queueManagementChange.getUpdatedQueueTemplate(); ((AutoCreatedLeafQueue) childQueue).validateConfigurations(template); break; } } }
csConf.getBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS, YarnConfiguration.DEFAULT_RM_SCHEDULER_ENABLE_MONITORS); CSQueue parentQ = q.getParent();
csConf.getBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS, YarnConfiguration.DEFAULT_RM_SCHEDULER_ENABLE_MONITORS); CSQueue parentQ = q.getParent();
.getBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS, YarnConfiguration.DEFAULT_RM_SCHEDULER_ENABLE_MONITORS); CSQueue parentQ = q.getParent();
CSQueue parentQ = q.getParent(); if (parentQ == null) { return configuration
(ManagedParentQueue) childQueue.getParent();
q = mockLeafQueue(p, tot, i, abs, used, pending, reserved, apps, gran); when(q.getParent()).thenReturn(p); when(q.getQueueName()).thenReturn(queueName); when(q.getAbsoluteUsedCapacity()).thenReturn(
if (parent != null && parent.getParent() != null) { if (parent.getAccessibleNodeLabels() != null && !parent.getAccessibleNodeLabels().contains(RMNodeLabelsManager.ANY)) {
if (parent != null && parent.getParent() != null) { if (parent.getAccessibleNodeLabels() != null && !parent.getAccessibleNodeLabels().contains(RMNodeLabelsManager.ANY)) {
return null; if (!queue.getParent().getQueueName().equals(queueName)) { String message = "Application: " + applicationId + " submitted to a reservation "
return null; if (!queue.getParent().getQueueName().equals(queueName)) { String message = "Application: " + applicationId + " submitted to a reservation "
return null; if (!queue.getParent().getQueueName().equals(queueName)) { String message = "Application: " + applicationId + " submitted to a reservation "
return; } else if (queue instanceof AutoCreatedLeafQueue && queue .getParent() instanceof ManagedParentQueue) { } else if (!queue.getParent().getQueueName().equals( placementContext.getParentQueue())) { String message = "Auto created Leaf queue " + placementContext.getQueue() + " " + "already exists under queue : " + queue .getParent().getQueuePath() + ".But Queue mapping configuration " + CapacitySchedulerConfiguration.QUEUE_MAPPING + " has been "
q = mockLeafQueue(p, tot, i, abs, used, pending, reserved, apps, gran); when(q.getParent()).thenReturn(p); when(q.getQueueName()).thenReturn(queueName); when(q.getAbsoluteUsedCapacity()).thenReturn(
protected void validateEffectiveMinResource(CSQueue leafQueue, String label, Map<String, QueueEntitlement> expectedQueueEntitlements) { ManagedParentQueue parentQueue = (ManagedParentQueue) leafQueue.getParent(); Resource resourceByLabel = mockRM.getRMContext().getNodeLabelManager(). getResourceByLabel(label, cs.getClusterResource()); Resource effMinCapacity = Resources.multiply(resourceByLabel, expectedQueueEntitlements.get(label).getCapacity() * parentQueue .getQueueCapacities().getAbsoluteCapacity(label)); assertEquals(effMinCapacity, Resources.multiply(resourceByLabel, leafQueue.getQueueCapacities().getAbsoluteCapacity(label))); assertEquals(effMinCapacity, leafQueue.getEffectiveCapacity(label)); if (leafQueue.getQueueCapacities().getAbsoluteCapacity(label) > 0) { assertTrue(Resources .greaterThan(cs.getResourceCalculator(), cs.getClusterResource(), effMinCapacity, Resources.none())); } else{ assertTrue(Resources.equals(effMinCapacity, Resources.none())); } }
CSQueue queueB4 = findQueue(queueB, B4); assertEquals(queueB, queueB4.getParent()); } finally { B3_CAPACITY += B4_CAPACITY;
CSQueue queueB4 = findQueue(queueB, B4); assertEquals(queueB, queueB4.getParent()); } finally { B3_CAPACITY += B4_CAPACITY;