YARN-8268. Fair scheduler: reservable queue is configured both as parent and leaf queue. (Gergo Repas via Haibo Chen)

This commit is contained in:
Haibo Chen 2018-05-11 11:28:05 -07:00
parent 8f7912e0fe
commit 1f10a36021
2 changed files with 14 additions and 1 deletions

View File

@ -217,7 +217,10 @@ private void loadQueue(String parentName, Element element,
// if a leaf in the alloc file is marked as type='parent' // if a leaf in the alloc file is marked as type='parent'
// then store it as a parent queue // then store it as a parent queue
if (isLeaf && !"parent".equals(element.getAttribute("type"))) { if (isLeaf && !"parent".equals(element.getAttribute("type"))) {
builder.configuredQueues(FSQueueType.LEAF, queueName); // reservable queue has been already configured as parent
if (!isReservable) {
builder.configuredQueues(FSQueueType.LEAF, queueName);
}
} else { } else {
if (isReservable) { if (isReservable) {
throw new AllocationConfigurationException("The configuration settings" throw new AllocationConfigurationException("The configuration settings"

View File

@ -42,6 +42,9 @@
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
@ -801,6 +804,13 @@ public void testReservableQueue() throws Exception {
String nonreservableQueueName = "root.other"; String nonreservableQueueName = "root.other";
assertFalse(allocConf.isReservable(nonreservableQueueName)); assertFalse(allocConf.isReservable(nonreservableQueueName));
assertTrue(allocConf.isReservable(reservableQueueName)); assertTrue(allocConf.isReservable(reservableQueueName));
Map<FSQueueType, Set<String>> configuredQueues =
allocConf.getConfiguredQueues();
assertTrue("reservable queue is expected be to a parent queue",
configuredQueues.get(FSQueueType.PARENT).contains(reservableQueueName));
assertFalse("reservable queue should not be a leaf queue",
configuredQueues.get(FSQueueType.LEAF)
.contains(reservableQueueName));
assertTrue(allocConf.getMoveOnExpiry(reservableQueueName)); assertTrue(allocConf.getMoveOnExpiry(reservableQueueName));
assertEquals(ReservationSchedulerConfiguration.DEFAULT_RESERVATION_WINDOW, assertEquals(ReservationSchedulerConfiguration.DEFAULT_RESERVATION_WINDOW,