@Override public void onReload(AllocationConfiguration queueInfo) throws IOException { // Commit the reload; also create any queue defined in the alloc file // if it does not already exist, so it can be displayed on the web UI. Set<String> removedStaticQueues = getRemovedStaticQueues(queueInfo); writeLock.lock(); try { if (queueInfo == null) { authorizer.setPermission(allocsLoader.getDefaultPermissions(), UserGroupInformation.getCurrentUser()); } else { allocConf = queueInfo; setQueueAcls(allocConf.getQueueAcls()); allocConf.getDefaultSchedulingPolicy().initialize(getContext()); queueMgr.updateAllocationConfiguration(allocConf); queueMgr.setQueuesToDynamic(removedStaticQueues); applyChildDefaults(); maxRunningEnforcer.updateRunnabilityOnReload(); } } finally { writeLock.unlock(); } }
queueManager.setQueuesToDynamic( ImmutableSet.of("root.parent1", "root.parent1.leaf1")); q1 = queueManager.getLeafQueue("root.parent1.leaf1", false);
@Test public void testRemovalOfChildlessParentQueue() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); FSParentQueue q1 = queueManager.getParentQueue("root.test.childB", false); assertNotNull("Queue root.test.childB was not created", q1); assertEquals("createQueue() returned wrong queue", "root.test.childB", q1.getName()); assertFalse("root.test.childB is a dynamic queue", q1.isDynamic()); // static queues should not be deleted queueManager.removePendingIncompatibleQueues(); queueManager.removeEmptyDynamicQueues(); q1 = queueManager.getParentQueue("root.test.childB", false); assertNotNull("Queue root.test.childB was deleted", q1); // next we remove root.test.childB from the allocation config allocConf.configuredQueues.get(FSQueueType.PARENT) .remove("root.test.childB"); queueManager.updateAllocationConfiguration(allocConf); queueManager.setQueuesToDynamic(Collections.singleton("root.test.childB")); // the next removeEmptyDynamicQueues() call should clean // root.test.childB up queueManager.removePendingIncompatibleQueues(); queueManager.removeEmptyDynamicQueues(); q1 = queueManager.getParentQueue("root.leaf1", false); assertNull("Queue root.leaf1 was not deleted", q1); }
queueManager.setQueuesToDynamic(queueNames); queueNames.clear();