From e6377972113db844d7e7b99867fad19d3cbc58bd Mon Sep 17 00:00:00 2001 From: Prabhu Joseph Date: Tue, 11 Feb 2020 19:35:31 +0530 Subject: [PATCH] YARN-10127. Remove setting App Ordering Policy to ParentQueue in FSQueueConverter Contributed by Peter Bacsko. --- .../fair/converter/FSQueueConverter.java | 42 ++++++++++--------- .../fair/converter/TestFSQueueConverter.java | 8 ++-- 2 files changed, 26 insertions(+), 24 deletions(-) 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/fair/converter/FSQueueConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/FSQueueConverter.java index 44bdad48bf3..f3812bcf20b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/FSQueueConverter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/FSQueueConverter.java @@ -294,28 +294,30 @@ public class FSQueueConverter { * @param queue */ private void emitOrderingPolicy(String queueName, FSQueue queue) { - String policy = queue.getPolicy().getName(); + if (queue instanceof FSLeafQueue) { + String policy = queue.getPolicy().getName(); - switch (policy) { - case DominantResourceFairnessPolicy.NAME: - capacitySchedulerConfig.set(PREFIX + queueName - + ".ordering-policy", FairSharePolicy.NAME); - break; - case FairSharePolicy.NAME: - capacitySchedulerConfig.set(PREFIX + queueName - + ".ordering-policy", FairSharePolicy.NAME); - if (drfUsed) { - ruleHandler.handleFairAsDrf(queueName); + switch (policy) { + case DominantResourceFairnessPolicy.NAME: + capacitySchedulerConfig.set(PREFIX + queueName + + ".ordering-policy", FairSharePolicy.NAME); + break; + case FairSharePolicy.NAME: + capacitySchedulerConfig.set(PREFIX + queueName + + ".ordering-policy", FairSharePolicy.NAME); + if (drfUsed) { + ruleHandler.handleFairAsDrf(queueName); + } + break; + case FifoPolicy.NAME: + capacitySchedulerConfig.set(PREFIX + queueName + + ".ordering-policy", FifoPolicy.NAME); + break; + default: + String msg = String.format("Unexpected ordering policy " + + "on queue %s: %s", queue, policy); + conversionOptions.handleConversionError(msg); } - break; - case FifoPolicy.NAME: - capacitySchedulerConfig.set(PREFIX + queueName - + ".ordering-policy", FifoPolicy.NAME); - break; - default: - String msg = String.format("Unexpected ordering policy " + - "on queue %s: %s", queue, policy); - conversionOptions.handleConversionError(msg); } } 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/fair/converter/TestFSQueueConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSQueueConverter.java index fe4faab6261..31e48bf6523 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSQueueConverter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSQueueConverter.java @@ -393,13 +393,13 @@ public class TestFSQueueConverter { converter.convertQueueHierarchy(rootQueue); // root - assertEquals("root ordering policy", "fair", + assertEquals("root ordering policy", null, csConfig.get(PREFIX + "root.ordering-policy")); assertEquals("root.default ordering policy", "fair", csConfig.get(PREFIX + "root.default.ordering-policy")); - assertEquals("root.admins ordering policy", "fair", + assertEquals("root.admins ordering policy", null, csConfig.get(PREFIX + "root.admins.ordering-policy")); - assertEquals("root.users ordering policy", "fair", + assertEquals("root.users ordering policy", null, csConfig.get(PREFIX + "root.users.ordering-policy")); // root.users @@ -429,7 +429,7 @@ public class TestFSQueueConverter { converter.convertQueueHierarchy(rootQueue); - verify(ruleHandler, times(6)).handleFairAsDrf(anyString()); + verify(ruleHandler, times(5)).handleFairAsDrf(anyString()); } @Test