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
This commit is contained in:
Sanford Ryza 2014-01-22 18:51:23 +00:00
parent ba6f1a2ed1
commit 1a7e158844
5 changed files with 28 additions and 19 deletions

View File

@ -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

View File

@ -80,7 +80,13 @@ public class QueuePlacementPolicy {
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<? extends QueuePlacementRule> clazz = ruleClasses.get(ruleName);
if (clazz == null) {
throw new AllocationConfigurationException("No rule class found for "

View File

@ -75,7 +75,7 @@ public class TestAllocationFileLoaderService {
out.println(" </queue>");
out.println(" <queue name=\"queueB\" />");
out.println(" <queuePlacementPolicy>");
out.println(" <default />");
out.println(" <rule name='default' />");
out.println(" </queuePlacementPolicy>");
out.println("</allocations>");
out.close();
@ -113,8 +113,8 @@ public class TestAllocationFileLoaderService {
out.println(" <maxRunningApps>3</maxRunningApps>");
out.println(" </queue>");
out.println(" <queuePlacementPolicy>");
out.println(" <specified />");
out.println(" <default />");
out.println(" <rule name='specified' />");
out.println(" <rule name='default' />");
out.println(" </queuePlacementPolicy>");
out.println("</allocations>");
out.close();

View File

@ -49,8 +49,8 @@ public class TestQueuePlacementPolicy {
public void testSpecifiedUserPolicy() throws Exception {
StringBuffer sb = new StringBuffer();
sb.append("<queuePlacementPolicy>");
sb.append(" <specified />");
sb.append(" <user />");
sb.append(" <rule name='specified' />");
sb.append(" <rule name='user' />");
sb.append("</queuePlacementPolicy>");
QueuePlacementPolicy policy = parse(sb.toString());
assertEquals("root.specifiedq",policy.assignAppToQueue("specifiedq", "someuser"));
@ -62,9 +62,9 @@ public class TestQueuePlacementPolicy {
public void testNoCreate() throws Exception {
StringBuffer sb = new StringBuffer();
sb.append("<queuePlacementPolicy>");
sb.append(" <specified />");
sb.append(" <user create=\"false\" />");
sb.append(" <default />");
sb.append(" <rule name='specified' />");
sb.append(" <rule name='user' create=\"false\" />");
sb.append(" <rule name='default' />");
sb.append("</queuePlacementPolicy>");
QueuePlacementPolicy policy = parse(sb.toString());
assertEquals("root.specifiedq", policy.assignAppToQueue("specifiedq", "someuser"));
@ -77,8 +77,8 @@ public class TestQueuePlacementPolicy {
public void testSpecifiedThenReject() throws Exception {
StringBuffer sb = new StringBuffer();
sb.append("<queuePlacementPolicy>");
sb.append(" <specified />");
sb.append(" <reject />");
sb.append(" <rule name='specified' />");
sb.append(" <rule name='reject' />");
sb.append("</queuePlacementPolicy>");
QueuePlacementPolicy policy = parse(sb.toString());
assertEquals("root.specifiedq", policy.assignAppToQueue("specifiedq", "someuser"));
@ -89,8 +89,8 @@ public class TestQueuePlacementPolicy {
public void testOmittedTerminalRule() throws Exception {
StringBuffer sb = new StringBuffer();
sb.append("<queuePlacementPolicy>");
sb.append(" <specified />");
sb.append(" <user create=\"false\" />");
sb.append(" <rule name='specified' />");
sb.append(" <rule name='user' create=\"false\" />");
sb.append("</queuePlacementPolicy>");
parse(sb.toString());
}
@ -99,9 +99,9 @@ public class TestQueuePlacementPolicy {
public void testTerminalRuleInMiddle() throws Exception {
StringBuffer sb = new StringBuffer();
sb.append("<queuePlacementPolicy>");
sb.append(" <specified />");
sb.append(" <default />");
sb.append(" <user />");
sb.append(" <rule name='specified' />");
sb.append(" <rule name='default' />");
sb.append(" <rule name='user' />");
sb.append("</queuePlacementPolicy>");
parse(sb.toString());
}

View File

@ -318,9 +318,9 @@ Allocation file format
<userMaxAppsDefault>5</userMaxAppsDefault>
<queuePlacementPolicy>
<specified />
<primarygroup create="false" />
<default />
<rule name="specified" />
<rule name="primaryGroup" create="false" />
<rule name="default" />
</queuePlacementPolicy>
</allocations>
---