@Override public void onReload(AllocationConfiguration queueInfo) { // 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. synchronized (FairScheduler.this) { allocConf = queueInfo; allocConf.getDefaultSchedulingPolicy().initialize(clusterResource); queueMgr.updateAllocationConfiguration(allocConf); maxRunningEnforcer.updateRunnabilityOnReload(); } } }
private void updateConfiguredLeafQueues(QueueManager queueMgr, String... confLeafQueues) { AllocationConfiguration allocConf = new AllocationConfiguration(conf); allocConf.configuredQueues.get(FSQueueType.LEAF).addAll(Sets.newHashSet(confLeafQueues)); queueMgr.updateAllocationConfiguration(allocConf); } }
@Override public void onReload(AllocationConfiguration queueInfo) { // 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. synchronized (FairScheduler.this) { allocConf = queueInfo; allocConf.getDefaultSchedulingPolicy().initialize(clusterResource); queueMgr.updateAllocationConfiguration(allocConf); maxRunningEnforcer.updateRunnabilityOnReload(); } } }
private void updateConfiguredLeafQueues(QueueManager queueMgr, String... confLeafQueues) { AllocationConfiguration allocConf = new AllocationConfiguration(conf); allocConf.configuredQueues.get(FSQueueType.LEAF).addAll(Sets.newHashSet(confLeafQueues)); queueMgr.updateAllocationConfiguration(allocConf); }
@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(); } }
@Test public void testReloadTurnsLeafToParentWithNoLeaf() { AllocationConfiguration allocConf = new AllocationConfiguration(conf); // Create a leaf queue1 allocConf.configuredQueues.get(FSQueueType.LEAF).add("root.queue1"); queueManager.updateAllocationConfiguration(allocConf); assertNotNull(queueManager.getLeafQueue("root.queue1", false)); // Lets say later on admin makes queue1 a parent queue by // specifying "type=parent" in the alloc xml and lets say apps running in // queue1 notEmptyQueues.add(queueManager.getLeafQueue("root.queue1", false)); allocConf = new AllocationConfiguration(conf); allocConf.configuredQueues.get(FSQueueType.PARENT) .add("root.queue1"); // When allocs are reloaded queue1 shouldn't be converter to parent queueManager.updateAllocationConfiguration(allocConf); assertNotNull(queueManager.getLeafQueue("root.queue1", false)); assertNull(queueManager.getParentQueue("root.queue1", false)); // Now lets assume apps completed and there are no apps in queue1 notEmptyQueues.clear(); // We should see queue1 transform from leaf queue to parent queue. queueManager.updateAllocationConfiguration(allocConf); assertNull(queueManager.getLeafQueue("root.queue1", false)); assertNotNull(queueManager.getParentQueue("root.queue1", false)); // this parent should not have any children assertTrue(queueManager.getParentQueue("root.queue1", false) .getChildQueues().isEmpty()); }
@Test public void testReloadTurnsLeafToParentWithNoLeaf() { AllocationConfiguration allocConf = new AllocationConfiguration(conf); // Create a leaf queue1 allocConf.configuredQueues.get(FSQueueType.LEAF).add("root.queue1"); queueManager.updateAllocationConfiguration(allocConf); assertNotNull(queueManager.getLeafQueue("root.queue1", false)); // Lets say later on admin makes queue1 a parent queue by // specifying "type=parent" in the alloc xml and lets say apps running in // queue1 notEmptyQueues.add(queueManager.getLeafQueue("root.queue1", false)); allocConf = new AllocationConfiguration(conf); allocConf.configuredQueues.get(FSQueueType.PARENT) .add("root.queue1"); // When allocs are reloaded queue1 shouldn't be converter to parent queueManager.updateAllocationConfiguration(allocConf); assertNotNull(queueManager.getLeafQueue("root.queue1", false)); assertNull(queueManager.getParentQueue("root.queue1", false)); // Now lets assume apps completed and there are no apps in queue1 notEmptyQueues.clear(); // We should see queue1 transform from leaf queue to parent queue. queueManager.updateAllocationConfiguration(allocConf); assertNull(queueManager.getLeafQueue("root.queue1", false)); assertNotNull(queueManager.getParentQueue("root.queue1", false)); // this parent should not have any children assertTrue(queueManager.getParentQueue("root.queue1", false) .getChildQueues().isEmpty()); }
@Test public void testQueueTypeChange() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); queueManager.updateAllocationConfiguration(allocConf); q1 = queueManager.getLeafQueue("root.parent1.leaf1", false); assertFalse("root.parent1.leaf1 is not a static queue", q1.isDynamic()); queueManager.updateAllocationConfiguration(allocConf); queueManager.setQueuesToDynamic( ImmutableSet.of("root.parent1", "root.parent1.leaf1"));
/** * Test creation of a simple parent queue. */ @Test public void testCreateParentQueue() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); FSQueue q1 = queueManager.createQueue("root.queue1", FSQueueType.PARENT); assertNotNull("Parent queue root.queue1 was not created", queueManager.getParentQueue("root.queue1", false)); assertEquals("createQueue() returned wrong queue", "root.queue1", q1.getName()); }
/** * Test simple leaf queue creation. */ @Test public void testCreateLeafQueue() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); FSQueue q1 = queueManager.createQueue("root.queue1", FSQueueType.LEAF); assertNotNull("Leaf queue root.queue1 was not created", queueManager.getLeafQueue("root.queue1", false)); assertEquals("createQueue() returned wrong queue", "root.queue1", q1.getName()); }
allocConf.configuredQueues.get(FSQueueType.LEAF).add("root.a"); scheduler.allocConf = allocConf; queueManager.updateAllocationConfiguration(allocConf); allocConf.configuredQueues.get(FSQueueType.PARENT).add("root.a"); allocConf.configuredQueues.get(FSQueueType.LEAF).add("root.a.b"); queueManager.updateAllocationConfiguration(allocConf);
@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); }
AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); queueManager.updateAllocationConfiguration(allocConf);
/** * Test creation of a leaf queue and its parent. */ @Test public void testCreateLeafQueueAndParent() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); FSQueue q2 = queueManager.createQueue("root.queue1.queue2", FSQueueType.LEAF); assertNotNull("Parent queue root.queue1 was not created", queueManager.getParentQueue("root.queue1", false)); assertNotNull("Leaf queue root.queue1.queue2 was not created", queueManager.getLeafQueue("root.queue1.queue2", false)); assertEquals("createQueue() returned wrong queue", "root.queue1.queue2", q2.getName()); }
/** * Test creation of a parent queue and its parent. */ @Test public void testCreateParentQueueAndParent() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); FSQueue q2 = queueManager.createQueue("root.queue1.queue2", FSQueueType.PARENT); assertNotNull("Parent queue root.queue1 was not created", queueManager.getParentQueue("root.queue1", false)); assertNotNull("Leaf queue root.queue1.queue2 was not created", queueManager.getParentQueue("root.queue1.queue2", false)); assertEquals("createQueue() returned wrong queue", "root.queue1.queue2", q2.getName()); }
@Test public void testNonEmptyStaticQueueBecomingDynamicQueue() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); queueNames.clear(); queueManager.updateAllocationConfiguration(allocConf);
@Test public void testRemovalOfDynamicLeafQueue() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); FSQueue q1 = queueManager.getLeafQueue("root.test.childB.dynamic1", true); assertNotNull("Queue root.test.childB.dynamic1 was not created", q1); assertEquals("createQueue() returned wrong queue", "root.test.childB.dynamic1", q1.getName()); assertTrue("root.test.childB.dynamic1 is not a dynamic queue", q1.isDynamic()); // an application is submitted to root.test.childB.dynamic1 notEmptyQueues.add(q1); // root.test.childB.dynamic1 is not empty and should not be removed queueManager.removePendingIncompatibleQueues(); queueManager.removeEmptyDynamicQueues(); q1 = queueManager.getLeafQueue("root.test.childB.dynamic1", false); assertNotNull("Queue root.test.childB.dynamic1 was deleted", q1); // the application finishes, the next removeEmptyDynamicQueues() should // clean root.test.childB.dynamic1 up, but keep its static parent notEmptyQueues.remove(q1); queueManager.removePendingIncompatibleQueues(); queueManager.removeEmptyDynamicQueues(); q1 = queueManager.getLeafQueue("root.test.childB.dynamic1", false); assertNull("Queue root.test.childB.dynamic1 was not deleted", q1); assertNotNull("The static parent of root.test.childB.dynamic1 was deleted", queueManager.getParentQueue("root.test.childB", false)); }
@Test public void testRemovalOfDynamicParentQueue() { AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); FSQueue q1 = queueManager.getLeafQueue("root.parent1.dynamic1", true); assertNotNull("Queue root.parent1.dynamic1 was not created", q1); assertEquals("createQueue() returned wrong queue", "root.parent1.dynamic1", q1.getName()); assertTrue("root.parent1.dynamic1 is not a dynamic queue", q1.isDynamic()); FSQueue p1 = queueManager.getParentQueue("root.parent1", false); assertNotNull("Queue root.parent1 was not created", p1); assertTrue("root.parent1 is not a dynamic queue", p1.isDynamic()); queueManager.removePendingIncompatibleQueues(); queueManager.removeEmptyDynamicQueues(); q1 = queueManager.getLeafQueue("root.parent1.dynamic1", false); p1 = queueManager.getParentQueue("root.parent1", false); assertNull("Queue root.parent1.dynamic1 was not deleted", q1); assertNull("Queue root.parent1 was not deleted", p1); }
queueManager = new QueueManager(scheduler); queueManager.initialize(conf); queueManager.updateAllocationConfiguration(allocConf);
AllocationConfiguration allocConf = scheduler.getAllocationConfiguration(); queueManager.updateAllocationConfiguration(allocConf); queueManager.getQueue("root.test").setMaxChildQueueResource( new ConfigurableResource(Resources.createResource(8192, 256)));