|
@@ -484,7 +484,7 @@ public class TestQueueParsing {
|
|
conf.setAccessibleNodeLabels(A, ImmutableSet.of("red", "blue"));
|
|
conf.setAccessibleNodeLabels(A, ImmutableSet.of("red", "blue"));
|
|
conf.setCapacityByLabel(A, "red", 90);
|
|
conf.setCapacityByLabel(A, "red", 90);
|
|
conf.setCapacityByLabel(A, "blue", 90);
|
|
conf.setCapacityByLabel(A, "blue", 90);
|
|
-
|
|
|
|
|
|
+
|
|
// Set B configuraiton
|
|
// Set B configuraiton
|
|
final String B = CapacitySchedulerConfiguration.ROOT + ".b";
|
|
final String B = CapacitySchedulerConfiguration.ROOT + ".b";
|
|
conf.setCapacity(B, 90);
|
|
conf.setCapacity(B, 90);
|
|
@@ -1188,6 +1188,82 @@ public class TestQueueParsing {
|
|
verifyQueueAbsCapacity(rm, A, "z", 1f);
|
|
verifyQueueAbsCapacity(rm, A, "z", 1f);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
+ public void testQueueParsingWithDefaultUserLimitValues()
|
|
|
|
+ throws IOException {
|
|
|
|
+ YarnConfiguration conf = new YarnConfiguration();
|
|
|
|
+ CapacitySchedulerConfiguration csConf =
|
|
|
|
+ new CapacitySchedulerConfiguration(conf);
|
|
|
|
+ final String queueA = CapacitySchedulerConfiguration.ROOT + ".a";
|
|
|
|
+ final String queueB = CapacitySchedulerConfiguration.ROOT + ".b";
|
|
|
|
+
|
|
|
|
+ // Define top-level queues
|
|
|
|
+ csConf.setQueues(CapacitySchedulerConfiguration.ROOT, new String[] {"a", "b"});
|
|
|
|
+
|
|
|
|
+ // Set default value
|
|
|
|
+ csConf.setDefaultUserLimit(20);
|
|
|
|
+ csConf.setDefaultUserLimitFactor(2.0f);
|
|
|
|
+
|
|
|
|
+ // Set A configuration and let B use default values
|
|
|
|
+ csConf.setCapacity(queueA, 50);
|
|
|
|
+ csConf.setUserLimit(queueA, 15);
|
|
|
|
+ csConf.setUserLimitFactor(queueA, 1.5f);
|
|
|
|
+ csConf.setCapacity(queueB, 50);
|
|
|
|
+
|
|
|
|
+ // Test
|
|
|
|
+ CapacityScheduler capacityScheduler = new CapacityScheduler();
|
|
|
|
+ RMContextImpl rmContext =
|
|
|
|
+ new RMContextImpl(null, null, null, null, null, null,
|
|
|
|
+ new RMContainerTokenSecretManager(csConf),
|
|
|
|
+ new NMTokenSecretManagerInRM(csConf),
|
|
|
|
+ new ClientToAMTokenSecretManagerInRM(), null);
|
|
|
|
+ rmContext.setNodeLabelManager(nodeLabelManager);
|
|
|
|
+ capacityScheduler.setConf(csConf);
|
|
|
|
+ capacityScheduler.setRMContext(rmContext);
|
|
|
|
+ capacityScheduler.init(csConf);
|
|
|
|
+ capacityScheduler.start();
|
|
|
|
+ Assert.assertEquals(15,
|
|
|
|
+ ((LeafQueue)capacityScheduler.getQueue(queueA)).getUserLimit(), DELTA);
|
|
|
|
+ Assert.assertEquals(1.5,
|
|
|
|
+ ((LeafQueue)capacityScheduler.getQueue(queueA)).getUserLimitFactor(), DELTA);
|
|
|
|
+ Assert.assertEquals(20,
|
|
|
|
+ ((LeafQueue)capacityScheduler.getQueue(queueB)).getUserLimit(), DELTA);
|
|
|
|
+ Assert.assertEquals(2.0,
|
|
|
|
+ ((LeafQueue)capacityScheduler.getQueue(queueB)).getUserLimitFactor(), DELTA);
|
|
|
|
+ ServiceOperations.stopQuietly(capacityScheduler);
|
|
|
|
+
|
|
|
|
+ // Use hadoop default value
|
|
|
|
+ conf = new YarnConfiguration();
|
|
|
|
+ csConf = new CapacitySchedulerConfiguration(conf);
|
|
|
|
+ csConf.setQueues(CapacitySchedulerConfiguration.ROOT, new String[] {"a", "b"});
|
|
|
|
+ csConf.setCapacity(queueA, 50);
|
|
|
|
+ csConf.setUserLimit(queueA, 15);
|
|
|
|
+ csConf.setUserLimitFactor(queueA, 1.5f);
|
|
|
|
+ csConf.setCapacity(queueB, 50);
|
|
|
|
+
|
|
|
|
+ // Test
|
|
|
|
+ capacityScheduler = new CapacityScheduler();
|
|
|
|
+ rmContext =
|
|
|
|
+ new RMContextImpl(null, null, null, null, null, null,
|
|
|
|
+ new RMContainerTokenSecretManager(csConf),
|
|
|
|
+ new NMTokenSecretManagerInRM(csConf),
|
|
|
|
+ new ClientToAMTokenSecretManagerInRM(), null);
|
|
|
|
+ rmContext.setNodeLabelManager(nodeLabelManager);
|
|
|
|
+ capacityScheduler.setConf(csConf);
|
|
|
|
+ capacityScheduler.setRMContext(rmContext);
|
|
|
|
+ capacityScheduler.init(csConf);
|
|
|
|
+ capacityScheduler.start();
|
|
|
|
+ Assert.assertEquals(15,
|
|
|
|
+ ((LeafQueue)capacityScheduler.getQueue(queueA)).getUserLimit(), DELTA);
|
|
|
|
+ Assert.assertEquals(1.5,
|
|
|
|
+ ((LeafQueue)capacityScheduler.getQueue(queueA)).getUserLimitFactor(), DELTA);
|
|
|
|
+ Assert.assertEquals(100,
|
|
|
|
+ ((LeafQueue)capacityScheduler.getQueue(queueB)).getUserLimit(), DELTA);
|
|
|
|
+ Assert.assertEquals(1,
|
|
|
|
+ ((LeafQueue)capacityScheduler.getQueue(queueB)).getUserLimitFactor(), DELTA);
|
|
|
|
+ ServiceOperations.stopQuietly(capacityScheduler);
|
|
|
|
+ }
|
|
|
|
+
|
|
private void verifyQueueAbsCapacity(MockRM rm, String queuePath, String label,
|
|
private void verifyQueueAbsCapacity(MockRM rm, String queuePath, String label,
|
|
float expectedAbsCapacity) {
|
|
float expectedAbsCapacity) {
|
|
CapacityScheduler cs = (CapacityScheduler) rm.getResourceScheduler();
|
|
CapacityScheduler cs = (CapacityScheduler) rm.getResourceScheduler();
|