[
https://issues.apache.org/jira/browse/YARN-1864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13965815#comment-13965815
]
Andrey Stepachev commented on YARN-1864:
----------------------------------------
It can be easily done with additional rules:
{code}
/**
* Places apps in queues by username of the submitter if username matched by
pattern
*/
public static class UserMatch extends QueuePlacementRule {
private Pattern pattern;
@Override
public QueuePlacementRule initialize(boolean create, Map<String, String>
args) {
super.initialize(create, args);
String patternArg = args == null ? ".*" : args.get("pattern");
if (patternArg == null)
patternArg = ".*";
pattern = Pattern.compile(patternArg);
return this;
}
@Override
protected String getQueueForApp(String requestedQueue,
String user, Groups groups,
Collection<String> configuredQueues) {
if (pattern.matcher(user).matches())
return prefix + user;
else
return "";
}
@Override
public boolean isTerminal() {
return false;
}
}
{code}
Then testcase can looks like:
{code}
@Test
public void testSpecifiedUserPolicyWithPrefix() throws Exception {
StringBuffer sb = new StringBuffer();
sb.append("<queuePlacementPolicy>");
sb.append(" <rule name='specified' parent='granted'/>");
sb.append(" <rule name='userMatch' parent='admin' pattern='admin.*'/>");
sb.append(" <rule name='user' parent='guests'/>");
sb.append("</queuePlacementPolicy>");
QueuePlacementPolicy policy = parse(sb.toString());
assertEquals("root.granted.specifiedq",policy.assignAppToQueue("specifiedq",
"someuser"));
assertEquals("root.admin.admin1", policy.assignAppToQueue("default",
"admin1"));
assertEquals("root.guests.someuser", policy.assignAppToQueue("default",
"someuser"));
assertEquals("root.guests.otheruser", policy.assignAppToQueue("default",
"otheruser"));
}
{code}
If that fit, I can add additional rules to patch (for complete solution).
> Fair Scheduler Dynamic Hierarchical User Queues
> -----------------------------------------------
>
> Key: YARN-1864
> URL: https://issues.apache.org/jira/browse/YARN-1864
> Project: Hadoop YARN
> Issue Type: New Feature
> Components: scheduler
> Reporter: Ashwin Shankar
> Labels: scheduler
> Attachments: YARN-1864-v1.txt
>
>
> In Fair Scheduler, we want to be able to create user queues under any parent
> queue in the hierarchy. For eg. Say user1 submits a job to a parent queue
> called root.allUserQueues, we want be able to create a new queue called
> root.allUserQueues.user1 and run user1's job in it.Any further jobs submitted
> by this user to root.allUserQueues will be run in this newly created
> root.allUserQueues.user1.
> This is very similar to the 'user-as-default' feature in Fair Scheduler which
> creates user queues under root queue. But we want the ability to create user
> queues under ANY parent queue.
> Why do we want this ?
> 1. Preemption : these dynamically created user queues can preempt each other
> if its fair share is not met. So there is fairness among users.
> User queues can also preempt other non-user leaf queue as well if below fair
> share.
> 2. Allocation to user queues : we want all the user queries(adhoc) to consume
> only a fraction of resources in the shared cluster. By creating this
> feature,we could do that by giving a fair share to the parent user queue
> which is then redistributed to all the dynamically created user queues.
--
This message was sent by Atlassian JIRA
(v6.2#6252)