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(),
|
||||
"%user"), create);
|
||||
break;
|
||||
case APPLICATION_NAME:
|
||||
action = MappingRuleActions.createPlaceToQueueAction(
|
||||
getTargetQueue(rule.getParentQueue(),
|
||||
"%application"), create);
|
||||
break;
|
||||
case SET_DEFAULT_QUEUE:
|
||||
String defaultQueue = rule.getValue();
|
||||
checkArgument(defaultQueue != null, "default queue is undefined");
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
"secondaryGroup",
|
||||
"primaryGroupUser",
|
||||
"secondaryGroupUser",
|
||||
"applicationName",
|
||||
"setDefaultQueue",
|
||||
"custom" ] },
|
||||
"parentQueue": { "type": "string" },
|
||||
|
|
|
@ -43,7 +43,7 @@ public class TestMappingRuleCreator {
|
|||
private static final String DEFAULT_QUEUE = "root.default";
|
||||
private static final String SECONDARY_GROUP = "users";
|
||||
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 USER_NAME = "testuser";
|
||||
|
||||
|
@ -316,6 +316,21 @@ public class TestMappingRuleCreator {
|
|||
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
|
||||
public void testDefaultQueueFallback() {
|
||||
rule.setFallbackResult(FallbackResult.PLACE_DEFAULT);
|
||||
|
|
Loading…
Reference in New Issue