Przeglądaj źródła

YARN-5055. max apps per user can be larger than max per queue. Contributed by Eric Badger
(cherry picked from commit ac954486c5102b8fbbc4229a0d3a512bcc7013c0)

Jason Lowe 9 lat temu
rodzic
commit
27aeab63c7

+ 3 - 0
hadoop-yarn-project/CHANGES.txt

@@ -139,6 +139,9 @@ Release 2.7.3 - UNRELEASED
     YARN-4747. AHS error 500 due to NPE when container start event is missing
     (Varun Saxena via jlowe)
 
+    YARN-5055. max apps per user can be larger than max per queue (Eric Badger
+    via jlowe)
+
 Release 2.7.2 - 2016-01-25
 
   INCOMPATIBLE CHANGES

+ 2 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/LeafQueue.java

@@ -170,8 +170,8 @@ public class LeafQueue extends AbstractCSQueue {
       maxApplications =
           (int) (maxSystemApps * queueCapacities.getAbsoluteCapacity());
     }
-    maxApplicationsPerUser = 
-      (int)(maxApplications * (userLimit / 100.0f) * userLimitFactor);
+    maxApplicationsPerUser = Math.min(maxApplications,
+        (int)(maxApplications * (userLimit / 100.0f) * userLimitFactor));
     
     maxAMResourcePerQueuePercent =
         conf.getMaximumApplicationMasterResourcePerQueuePercent(getQueuePath());

+ 5 - 4
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestApplicationLimits.java

@@ -310,8 +310,9 @@ public class TestApplicationLimits {
         queue.getAbsoluteCapacity());
     assertEquals(expectedMaxApps, queue.getMaxApplications());
 
-    int expectedMaxAppsPerUser = (int)(expectedMaxApps *
-        (queue.getUserLimit()/100.0f) * queue.getUserLimitFactor());
+    int expectedMaxAppsPerUser = Math.min(expectedMaxApps,
+        (int)(expectedMaxApps * (queue.getUserLimit()/100.0f) *
+        queue.getUserLimitFactor()));
     assertEquals(expectedMaxAppsPerUser, queue.getMaxApplicationsPerUser());
 
     // should default to global setting if per queue setting not set
@@ -360,8 +361,8 @@ public class TestApplicationLimits {
     assertEquals(9999, (int)csConf.getMaximumApplicationsPerQueue(queue.getQueuePath()));
     assertEquals(9999, queue.getMaxApplications());
 
-    expectedMaxAppsPerUser = (int)(9999 *
-        (queue.getUserLimit()/100.0f) * queue.getUserLimitFactor());
+    expectedMaxAppsPerUser = Math.min(9999, (int)(9999 *
+        (queue.getUserLimit()/100.0f) * queue.getUserLimitFactor()));
     assertEquals(expectedMaxAppsPerUser, queue.getMaxApplicationsPerUser());
   }
   

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

@@ -433,8 +433,9 @@ public class TestRMWebServicesCapacitySched extends JerseyTestBase {
 
     int maxSystemApps = csConf.getMaximumSystemApplications();
     int expectedMaxApps = (int)(maxSystemApps * (info.absoluteCapacity/100));
-    int expectedMaxAppsPerUser =
-      (int)(expectedMaxApps * (info.userLimit/100.0f) * info.userLimitFactor);
+    int expectedMaxAppsPerUser = Math.min(expectedMaxApps,
+        (int)(expectedMaxApps * (info.userLimit/100.0f) *
+        info.userLimitFactor));
 
     // TODO: would like to use integer comparisons here but can't due to
     //       roundoff errors in absolute capacity calculations