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:
parent
ba6f1a2ed1
commit
1a7e158844
@ -231,6 +231,9 @@ Release 2.4.0 - UNRELEASED
|
|||||||
|
|
||||||
YARN-1616. RMFatalEventDispatcher should log the cause of the event (kasha)
|
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
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
@ -80,7 +80,13 @@ public static QueuePlacementPolicy fromXml(Element el, Set<String> configuredQue
|
|||||||
Node node = elements.item(i);
|
Node node = elements.item(i);
|
||||||
if (node instanceof Element) {
|
if (node instanceof Element) {
|
||||||
Element element = (Element)node;
|
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);
|
Class<? extends QueuePlacementRule> clazz = ruleClasses.get(ruleName);
|
||||||
if (clazz == null) {
|
if (clazz == null) {
|
||||||
throw new AllocationConfigurationException("No rule class found for "
|
throw new AllocationConfigurationException("No rule class found for "
|
||||||
|
@ -75,7 +75,7 @@ public void testReload() throws Exception {
|
|||||||
out.println(" </queue>");
|
out.println(" </queue>");
|
||||||
out.println(" <queue name=\"queueB\" />");
|
out.println(" <queue name=\"queueB\" />");
|
||||||
out.println(" <queuePlacementPolicy>");
|
out.println(" <queuePlacementPolicy>");
|
||||||
out.println(" <default />");
|
out.println(" <rule name='default' />");
|
||||||
out.println(" </queuePlacementPolicy>");
|
out.println(" </queuePlacementPolicy>");
|
||||||
out.println("</allocations>");
|
out.println("</allocations>");
|
||||||
out.close();
|
out.close();
|
||||||
@ -113,8 +113,8 @@ public void testReload() throws Exception {
|
|||||||
out.println(" <maxRunningApps>3</maxRunningApps>");
|
out.println(" <maxRunningApps>3</maxRunningApps>");
|
||||||
out.println(" </queue>");
|
out.println(" </queue>");
|
||||||
out.println(" <queuePlacementPolicy>");
|
out.println(" <queuePlacementPolicy>");
|
||||||
out.println(" <specified />");
|
out.println(" <rule name='specified' />");
|
||||||
out.println(" <default />");
|
out.println(" <rule name='default' />");
|
||||||
out.println(" </queuePlacementPolicy>");
|
out.println(" </queuePlacementPolicy>");
|
||||||
out.println("</allocations>");
|
out.println("</allocations>");
|
||||||
out.close();
|
out.close();
|
||||||
|
@ -49,8 +49,8 @@ public static void setup() {
|
|||||||
public void testSpecifiedUserPolicy() throws Exception {
|
public void testSpecifiedUserPolicy() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append("<queuePlacementPolicy>");
|
sb.append("<queuePlacementPolicy>");
|
||||||
sb.append(" <specified />");
|
sb.append(" <rule name='specified' />");
|
||||||
sb.append(" <user />");
|
sb.append(" <rule name='user' />");
|
||||||
sb.append("</queuePlacementPolicy>");
|
sb.append("</queuePlacementPolicy>");
|
||||||
QueuePlacementPolicy policy = parse(sb.toString());
|
QueuePlacementPolicy policy = parse(sb.toString());
|
||||||
assertEquals("root.specifiedq",policy.assignAppToQueue("specifiedq", "someuser"));
|
assertEquals("root.specifiedq",policy.assignAppToQueue("specifiedq", "someuser"));
|
||||||
@ -62,9 +62,9 @@ public void testSpecifiedUserPolicy() throws Exception {
|
|||||||
public void testNoCreate() throws Exception {
|
public void testNoCreate() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append("<queuePlacementPolicy>");
|
sb.append("<queuePlacementPolicy>");
|
||||||
sb.append(" <specified />");
|
sb.append(" <rule name='specified' />");
|
||||||
sb.append(" <user create=\"false\" />");
|
sb.append(" <rule name='user' create=\"false\" />");
|
||||||
sb.append(" <default />");
|
sb.append(" <rule name='default' />");
|
||||||
sb.append("</queuePlacementPolicy>");
|
sb.append("</queuePlacementPolicy>");
|
||||||
QueuePlacementPolicy policy = parse(sb.toString());
|
QueuePlacementPolicy policy = parse(sb.toString());
|
||||||
assertEquals("root.specifiedq", policy.assignAppToQueue("specifiedq", "someuser"));
|
assertEquals("root.specifiedq", policy.assignAppToQueue("specifiedq", "someuser"));
|
||||||
@ -77,8 +77,8 @@ public void testNoCreate() throws Exception {
|
|||||||
public void testSpecifiedThenReject() throws Exception {
|
public void testSpecifiedThenReject() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append("<queuePlacementPolicy>");
|
sb.append("<queuePlacementPolicy>");
|
||||||
sb.append(" <specified />");
|
sb.append(" <rule name='specified' />");
|
||||||
sb.append(" <reject />");
|
sb.append(" <rule name='reject' />");
|
||||||
sb.append("</queuePlacementPolicy>");
|
sb.append("</queuePlacementPolicy>");
|
||||||
QueuePlacementPolicy policy = parse(sb.toString());
|
QueuePlacementPolicy policy = parse(sb.toString());
|
||||||
assertEquals("root.specifiedq", policy.assignAppToQueue("specifiedq", "someuser"));
|
assertEquals("root.specifiedq", policy.assignAppToQueue("specifiedq", "someuser"));
|
||||||
@ -89,8 +89,8 @@ public void testSpecifiedThenReject() throws Exception {
|
|||||||
public void testOmittedTerminalRule() throws Exception {
|
public void testOmittedTerminalRule() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append("<queuePlacementPolicy>");
|
sb.append("<queuePlacementPolicy>");
|
||||||
sb.append(" <specified />");
|
sb.append(" <rule name='specified' />");
|
||||||
sb.append(" <user create=\"false\" />");
|
sb.append(" <rule name='user' create=\"false\" />");
|
||||||
sb.append("</queuePlacementPolicy>");
|
sb.append("</queuePlacementPolicy>");
|
||||||
parse(sb.toString());
|
parse(sb.toString());
|
||||||
}
|
}
|
||||||
@ -99,9 +99,9 @@ public void testOmittedTerminalRule() throws Exception {
|
|||||||
public void testTerminalRuleInMiddle() throws Exception {
|
public void testTerminalRuleInMiddle() throws Exception {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append("<queuePlacementPolicy>");
|
sb.append("<queuePlacementPolicy>");
|
||||||
sb.append(" <specified />");
|
sb.append(" <rule name='specified' />");
|
||||||
sb.append(" <default />");
|
sb.append(" <rule name='default' />");
|
||||||
sb.append(" <user />");
|
sb.append(" <rule name='user' />");
|
||||||
sb.append("</queuePlacementPolicy>");
|
sb.append("</queuePlacementPolicy>");
|
||||||
parse(sb.toString());
|
parse(sb.toString());
|
||||||
}
|
}
|
||||||
|
@ -318,9 +318,9 @@ Allocation file format
|
|||||||
<userMaxAppsDefault>5</userMaxAppsDefault>
|
<userMaxAppsDefault>5</userMaxAppsDefault>
|
||||||
|
|
||||||
<queuePlacementPolicy>
|
<queuePlacementPolicy>
|
||||||
<specified />
|
<rule name="specified" />
|
||||||
<primarygroup create="false" />
|
<rule name="primaryGroup" create="false" />
|
||||||
<default />
|
<rule name="default" />
|
||||||
</queuePlacementPolicy>
|
</queuePlacementPolicy>
|
||||||
</allocations>
|
</allocations>
|
||||||
---
|
---
|
||||||
|
Loading…
Reference in New Issue
Block a user