YARN-5055. max apps per user can be larger than max per queue. Contributed by Eric Badger

This commit is contained in:
Jason Lowe 2016-05-23 15:54:42 +00:00
parent d1df0266cf
commit ac954486c5
3 changed files with 10 additions and 8 deletions

View File

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

View File

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

View File

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