Browse Source

YARN-11023. Extend the root QueueInfo with max-parallel-apps in CapacityScheduler. Contributed by Tamas Domok

Szilard Nemeth 3 years ago
parent
commit
60440a836a

+ 2 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/CapacitySchedulerInfo.java

@@ -50,6 +50,7 @@ public class CapacitySchedulerInfo extends SchedulerInfo {
   protected float normalizedWeight;
   protected String queueName;
   private String queuePath;
+  protected int maxParallelApps;
   protected CapacitySchedulerQueueInfoList queues;
   protected QueueCapacitiesInfo capacities;
   protected CapacitySchedulerHealthInfo health;
@@ -83,6 +84,7 @@ public class CapacitySchedulerInfo extends SchedulerInfo {
     this.maxCapacity = max * 100;
     this.weight = parent.getQueueCapacities().getWeight();
     this.normalizedWeight = parent.getQueueCapacities().getNormalizedWeight();
+    this.maxParallelApps = parent.getMaxParallelApps();
 
     capacities = new QueueCapacitiesInfo(parent.getQueueCapacities(),
         parent.getQueueResourceQuotas(), false);

+ 7 - 4
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java

@@ -270,7 +270,8 @@ public class TestRMWebServicesCapacitySched extends JerseyTestBase {
           WebServicesTestUtils.getXmlFloat(element, "capacity"),
           WebServicesTestUtils.getXmlFloat(element, "maxCapacity"),
           WebServicesTestUtils.getXmlString(element, "queueName"),
-          WebServicesTestUtils.getXmlString(element, "queuePath"));
+          WebServicesTestUtils.getXmlString(element, "queuePath"),
+          WebServicesTestUtils.getXmlInt(element, "maxParallelApps"));
 
       NodeList children = element.getChildNodes();
       for (int j = 0; j < children.getLength(); j++) {
@@ -374,13 +375,14 @@ public class TestRMWebServicesCapacitySched extends JerseyTestBase {
     JSONObject info = json.getJSONObject("scheduler");
     assertEquals("incorrect number of elements in: " + info, 1, info.length());
     info = info.getJSONObject("schedulerInfo");
-    assertEquals("incorrect number of elements in: " + info, 22, info.length());
+    assertEquals("incorrect number of elements in: " + info, 23, info.length());
     verifyClusterSchedulerGeneric(info.getString("type"),
         (float) info.getDouble("usedCapacity"),
         (float) info.getDouble("capacity"),
         (float) info.getDouble("maxCapacity"),
         info.getString("queueName"),
-        info.getString("queuePath"));
+        info.getString("queuePath"),
+        info.getInt("maxParallelApps"));
     JSONObject health = info.getJSONObject("health");
     assertNotNull(health);
     assertEquals("incorrect number of elements in: " + health, 3,
@@ -415,7 +417,7 @@ public class TestRMWebServicesCapacitySched extends JerseyTestBase {
   }
 
   private void verifyClusterSchedulerGeneric(String type, float usedCapacity,
-      float capacity, float maxCapacity, String queueName, String queuePath)
+      float capacity, float maxCapacity, String queueName, String queuePath, int maxParallelApps)
       throws Exception {
 
     assertTrue("type doesn't match", "capacityScheduler".matches(type));
@@ -424,6 +426,7 @@ public class TestRMWebServicesCapacitySched extends JerseyTestBase {
     assertEquals("maxCapacity doesn't match", 100, maxCapacity, 1e-3f);
     assertTrue("queueName doesn't match", "root".matches(queueName));
     assertTrue("queuePath doesn't match", "root".matches(queuePath));
+    assertEquals("maxParallelApps doesn't match ", Integer.MAX_VALUE, maxParallelApps);
   }
 
   private void verifySubQueue(JSONObject info, String q,

+ 1 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesForCSWithPartitions.java

@@ -574,7 +574,7 @@ public class TestRMWebServicesForCSWithPartitions extends JerseyTestBase {
     JSONObject info = json.getJSONObject("scheduler");
     assertEquals("incorrect number of elements", 1, info.length());
     info = info.getJSONObject("schedulerInfo");
-    assertEquals("incorrect number of elements", 22, info.length());
+    assertEquals("incorrect number of elements", 23, info.length());
     JSONObject capacitiesJsonObject = info.getJSONObject(CAPACITIES);
     JSONArray partitionsCapsArray =
         capacitiesJsonObject.getJSONArray(QUEUE_CAPACITIES_BY_PARTITION);