YARN-4235. FairScheduler PrimaryGroup does not handle empty groups returned for a user. (Anubhav Dhoot via rohithsharmaks)
(cherry picked from commit 8f195387a4
)
This commit is contained in:
parent
2c6c9e315c
commit
21609e8e9a
|
@ -860,6 +860,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
|
|
||||||
YARN-4228. FileSystemRMStateStore use IOUtils#close instead of fs#close. (Bibin A Chundatt via rohithsharmaks)
|
YARN-4228. FileSystemRMStateStore use IOUtils#close instead of fs#close. (Bibin A Chundatt via rohithsharmaks)
|
||||||
|
|
||||||
|
YARN-4235. FairScheduler PrimaryGroup does not handle empty groups returned
|
||||||
|
for a user. (Anubhav Dhoot via rohithsharmaks)
|
||||||
|
|
||||||
Release 2.7.2 - UNRELEASED
|
Release 2.7.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -146,7 +146,11 @@ public abstract class QueuePlacementRule {
|
||||||
protected String getQueueForApp(String requestedQueue, String user,
|
protected String getQueueForApp(String requestedQueue, String user,
|
||||||
Groups groups, Map<FSQueueType, Set<String>> configuredQueues)
|
Groups groups, Map<FSQueueType, Set<String>> configuredQueues)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return "root." + cleanName(groups.getGroups(user).get(0));
|
final List<String> groupList = groups.getGroups(user);
|
||||||
|
if (groupList.isEmpty()) {
|
||||||
|
throw new IOException("No groups returned for user " + user);
|
||||||
|
}
|
||||||
|
return "root." + cleanName(groupList.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,8 +19,11 @@ package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -393,6 +396,21 @@ public class TestQueuePlacementPolicy {
|
||||||
SimpleGroupsMapping.class, GroupMappingServiceProvider.class);
|
SimpleGroupsMapping.class, GroupMappingServiceProvider.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected=IOException.class)
|
||||||
|
public void testEmptyGroupsPrimaryGroupRule() throws Exception {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append("<queuePlacementPolicy>");
|
||||||
|
sb.append(" <rule name='primaryGroup' create=\"false\" />");
|
||||||
|
sb.append(" <rule name='default' />");
|
||||||
|
sb.append("</queuePlacementPolicy>");
|
||||||
|
|
||||||
|
// Add a static mapping that returns empty groups for users
|
||||||
|
conf.setStrings(CommonConfigurationKeys
|
||||||
|
.HADOOP_USER_GROUP_STATIC_OVERRIDES, "emptygroupuser=");
|
||||||
|
QueuePlacementPolicy policy = parse(sb.toString());
|
||||||
|
policy.assignAppToQueue(null, "emptygroupuser");
|
||||||
|
}
|
||||||
|
|
||||||
private QueuePlacementPolicy parse(String str) throws Exception {
|
private QueuePlacementPolicy parse(String str) throws Exception {
|
||||||
// Read and parse the allocations file.
|
// Read and parse the allocations file.
|
||||||
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
|
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
|
||||||
|
|
Loading…
Reference in New Issue