From 1a7e1588443071e497c6fea0224a78ca8de1cf3e Mon Sep 17 00:00:00 2001 From: Sanford Ryza Date: Wed, 22 Jan 2014 18:51:23 +0000 Subject: [PATCH] YARN-1624. QueuePlacementPolicy format is not easily readable via a JAXB parser (Aditya Acharya via Sandy Ryza) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1560470 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../scheduler/fair/QueuePlacementPolicy.java | 8 ++++++- .../fair/TestAllocationFileLoaderService.java | 6 ++--- .../fair/TestQueuePlacementPolicy.java | 24 +++++++++---------- .../src/site/apt/FairScheduler.apt.vm | 6 ++--- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 8b9ee18966..911f247c8a 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -231,6 +231,9 @@ Release 2.4.0 - UNRELEASED YARN-1616. RMFatalEventDispatcher should log the cause of the event (kasha) + YARN-1624. QueuePlacementPolicy format is not easily readable via a JAXB + parser (Aditya Acharya via Sandy Ryza) + OPTIMIZATIONS BUG FIXES 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/QueuePlacementPolicy.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/QueuePlacementPolicy.java index d802e70964..1fd18e7c97 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/QueuePlacementPolicy.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/QueuePlacementPolicy.java @@ -80,7 +80,13 @@ public static QueuePlacementPolicy fromXml(Element el, Set configuredQue Node node = elements.item(i); if (node instanceof Element) { Element element = (Element)node; - String ruleName = element.getTagName(); + + String ruleName = element.getAttribute("name"); + if ("".equals(ruleName)) { + throw new AllocationConfigurationException("No name provided for a " + + "rule element"); + } + Class clazz = ruleClasses.get(ruleName); if (clazz == null) { throw new AllocationConfigurationException("No rule class found for " 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/TestAllocationFileLoaderService.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/TestAllocationFileLoaderService.java index dc28a3b3ff..939d53b570 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/TestAllocationFileLoaderService.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/TestAllocationFileLoaderService.java @@ -75,7 +75,7 @@ public void testReload() throws Exception { out.println(" "); out.println(" "); out.println(" "); - out.println(" "); + out.println(" "); out.println(" "); out.println(""); out.close(); @@ -113,8 +113,8 @@ public void testReload() throws Exception { out.println(" 3"); out.println(" "); out.println(" "); - out.println(" "); - out.println(" "); + out.println(" "); + out.println(" "); out.println(" "); out.println(""); out.close(); 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/TestQueuePlacementPolicy.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/TestQueuePlacementPolicy.java index 130fe35327..5b5a51fa78 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/TestQueuePlacementPolicy.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/TestQueuePlacementPolicy.java @@ -49,8 +49,8 @@ public static void setup() { public void testSpecifiedUserPolicy() throws Exception { StringBuffer sb = new StringBuffer(); sb.append(""); - sb.append(" "); - sb.append(" "); + sb.append(" "); + sb.append(" "); sb.append(""); QueuePlacementPolicy policy = parse(sb.toString()); assertEquals("root.specifiedq",policy.assignAppToQueue("specifiedq", "someuser")); @@ -62,9 +62,9 @@ public void testSpecifiedUserPolicy() throws Exception { public void testNoCreate() throws Exception { StringBuffer sb = new StringBuffer(); sb.append(""); - sb.append(" "); - sb.append(" "); - sb.append(" "); + sb.append(" "); + sb.append(" "); + sb.append(" "); sb.append(""); QueuePlacementPolicy policy = parse(sb.toString()); assertEquals("root.specifiedq", policy.assignAppToQueue("specifiedq", "someuser")); @@ -77,8 +77,8 @@ public void testNoCreate() throws Exception { public void testSpecifiedThenReject() throws Exception { StringBuffer sb = new StringBuffer(); sb.append(""); - sb.append(" "); - sb.append(" "); + sb.append(" "); + sb.append(" "); sb.append(""); QueuePlacementPolicy policy = parse(sb.toString()); assertEquals("root.specifiedq", policy.assignAppToQueue("specifiedq", "someuser")); @@ -89,8 +89,8 @@ public void testSpecifiedThenReject() throws Exception { public void testOmittedTerminalRule() throws Exception { StringBuffer sb = new StringBuffer(); sb.append(""); - sb.append(" "); - sb.append(" "); + sb.append(" "); + sb.append(" "); sb.append(""); parse(sb.toString()); } @@ -99,9 +99,9 @@ public void testOmittedTerminalRule() throws Exception { public void testTerminalRuleInMiddle() throws Exception { StringBuffer sb = new StringBuffer(); sb.append(""); - sb.append(" "); - sb.append(" "); - sb.append(" "); + sb.append(" "); + sb.append(" "); + sb.append(" "); sb.append(""); parse(sb.toString()); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/FairScheduler.apt.vm b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/FairScheduler.apt.vm index 29b9fd31d0..655de70c1d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/FairScheduler.apt.vm +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/apt/FairScheduler.apt.vm @@ -318,9 +318,9 @@ Allocation file format 5 - - - + + + ---