فهرست منبع

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

Haibo Chen 7 سال پیش
والد
کامیت
1f10a36021

+ 4 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/allocation/AllocationFileQueueParser.java

@@ -217,7 +217,10 @@ public class AllocationFileQueueParser {
     // if a leaf in the alloc file is marked as type='parent'
     // then store it as a parent queue
     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 {
       if (isReservable) {
         throw new AllocationConfigurationException("The configuration settings"

+ 10 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestAllocationFileLoaderService.java

@@ -42,6 +42,9 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
@@ -801,6 +804,13 @@ public class TestAllocationFileLoaderService {
     String nonreservableQueueName = "root.other";
     assertFalse(allocConf.isReservable(nonreservableQueueName));
     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));
     assertEquals(ReservationSchedulerConfiguration.DEFAULT_RESERVATION_WINDOW,