diff --git a/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 b/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 index c7f42d1ad3607..4592f2afd198f 100644 --- a/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 +++ b/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 @@ -1707,12 +1707,12 @@ protected boolean canAssignToUser(Resource clusterResource, @Override protected void setDynamicQueueProperties( CapacitySchedulerConfiguration configuration) { - super.setDynamicQueueProperties(configuration); // set to -1, to disable it configuration.setUserLimitFactor(getQueuePath(), -1); // Set Max AM percentage to a higher value configuration.setMaximumApplicationMasterResourcePerQueuePercent( getQueuePath(), 1f); + super.setDynamicQueueProperties(configuration); } private void updateSchedulerHealthForCompletedContainer( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacitySchedulerNewQueueAutoCreation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacitySchedulerNewQueueAutoCreation.java index 9b23fdd9033a1..3d40ccf26c6a6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacitySchedulerNewQueueAutoCreation.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacitySchedulerNewQueueAutoCreation.java @@ -688,11 +688,27 @@ public void testAutoCreatedQueueTemplateConfig() throws Exception { LeafQueue a2 = createQueue("root.a.a-auto.a2"); Assert.assertEquals("weight is not set by template", 6f, a2.getQueueCapacities().getWeight(), 1e-6); + Assert.assertEquals("user limit factor should be disabled with dynamic queues", + -1f, a2.getUserLimitFactor(), 1e-6); + Assert.assertEquals("maximum AM resource percent should be 1 with dynamic queues", + 1f, a2.getMaxAMResourcePerQueuePercent(), 1e-6); + + // Set the user-limit-factor and maximum-am-resource-percent via templates to ensure their + // modified defaults are indeed overridden + csConf.set(AutoCreatedQueueTemplate.getAutoQueueTemplatePrefix( + "root.a.*") + "user-limit-factor", "10"); + csConf.set(AutoCreatedQueueTemplate.getAutoQueueTemplatePrefix( + "root.a.*") + "maximum-am-resource-percent", "0.8"); cs.reinitialize(csConf, mockRM.getRMContext()); a2 = (LeafQueue) cs.getQueue("root.a.a-auto.a2"); Assert.assertEquals("weight is overridden", 6f, a2.getQueueCapacities().getWeight(), 1e-6); + Assert.assertEquals("user limit factor should be modified by templates", + 10f, a2.getUserLimitFactor(), 1e-6); + Assert.assertEquals("maximum AM resource percent should be modified by templates", + 0.8f, a2.getMaxAMResourcePerQueuePercent(), 1e-6); + csConf.setNonLabeledQueueWeight("root.a.a-auto.a2", 4f); cs.reinitialize(csConf, mockRM.getRMContext());