YARN-10454: Add applicationName policy. Contributed by Peter Bacsko
This commit is contained in:
parent
b3786d6c3c
commit
42358169f6
|
@ -166,6 +166,11 @@ public class MappingRuleCreator {
|
||||||
getTargetQueue(rule.getParentQueue(),
|
getTargetQueue(rule.getParentQueue(),
|
||||||
"%user"), create);
|
"%user"), create);
|
||||||
break;
|
break;
|
||||||
|
case APPLICATION_NAME:
|
||||||
|
action = MappingRuleActions.createPlaceToQueueAction(
|
||||||
|
getTargetQueue(rule.getParentQueue(),
|
||||||
|
"%application"), create);
|
||||||
|
break;
|
||||||
case SET_DEFAULT_QUEUE:
|
case SET_DEFAULT_QUEUE:
|
||||||
String defaultQueue = rule.getValue();
|
String defaultQueue = rule.getValue();
|
||||||
checkArgument(defaultQueue != null, "default queue is undefined");
|
checkArgument(defaultQueue != null, "default queue is undefined");
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
"secondaryGroup",
|
"secondaryGroup",
|
||||||
"primaryGroupUser",
|
"primaryGroupUser",
|
||||||
"secondaryGroupUser",
|
"secondaryGroupUser",
|
||||||
|
"applicationName",
|
||||||
"setDefaultQueue",
|
"setDefaultQueue",
|
||||||
"custom" ] },
|
"custom" ] },
|
||||||
"parentQueue": { "type": "string" },
|
"parentQueue": { "type": "string" },
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class TestMappingRuleCreator {
|
||||||
private static final String DEFAULT_QUEUE = "root.default";
|
private static final String DEFAULT_QUEUE = "root.default";
|
||||||
private static final String SECONDARY_GROUP = "users";
|
private static final String SECONDARY_GROUP = "users";
|
||||||
private static final String PRIMARY_GROUP = "superuser";
|
private static final String PRIMARY_GROUP = "superuser";
|
||||||
private static final String APPLICATION_NAME = "MapReduce";
|
private static final String APPLICATION_NAME = "testapplication";
|
||||||
private static final String SPECIFIED_QUEUE = "root.users.hadoop";
|
private static final String SPECIFIED_QUEUE = "root.users.hadoop";
|
||||||
private static final String USER_NAME = "testuser";
|
private static final String USER_NAME = "testuser";
|
||||||
|
|
||||||
|
@ -316,6 +316,21 @@ public class TestMappingRuleCreator {
|
||||||
verifyPlacementSucceeds("root.users.testuser");
|
verifyPlacementSucceeds("root.users.testuser");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testApplicationNamePlacement() {
|
||||||
|
rule.setPolicy(Policy.APPLICATION_NAME);
|
||||||
|
|
||||||
|
verifyPlacementSucceeds(APPLICATION_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testApplicationNamePlacementWithParent() {
|
||||||
|
rule.setPolicy(Policy.APPLICATION_NAME);
|
||||||
|
rule.setParentQueue("root.applications");
|
||||||
|
|
||||||
|
verifyPlacementSucceeds("root.applications." + APPLICATION_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultQueueFallback() {
|
public void testDefaultQueueFallback() {
|
||||||
rule.setFallbackResult(FallbackResult.PLACE_DEFAULT);
|
rule.setFallbackResult(FallbackResult.PLACE_DEFAULT);
|
||||||
|
|
Loading…
Reference in New Issue