hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rohithsharm...@apache.org
Subject hadoop git commit: YARN-4235. FairScheduler PrimaryGroup does not handle empty groups returned for a user. (Anubhav Dhoot via rohithsharmaks)
Date Fri, 09 Oct 2015 04:41:25 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk e1bf8b3df -> 8f195387a


YARN-4235. FairScheduler PrimaryGroup does not handle empty groups returned for a user. (Anubhav
Dhoot via rohithsharmaks)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8f195387
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8f195387
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8f195387

Branch: refs/heads/trunk
Commit: 8f195387a4a4a5a278119bf4c2f15cad61f0e2c7
Parents: e1bf8b3
Author: Rohith Sharma K S <rohithsharmaks@apache.org>
Authored: Fri Oct 9 10:09:26 2015 +0530
Committer: Rohith Sharma K S <rohithsharmaks@apache.org>
Committed: Fri Oct 9 10:09:26 2015 +0530

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                   |  3 +++
 .../scheduler/fair/QueuePlacementRule.java        |  6 +++++-
 .../scheduler/fair/TestQueuePlacementPolicy.java  | 18 ++++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f195387/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index b4801bc..189ae8f 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -912,6 +912,9 @@ Release 2.8.0 - UNRELEASED
 
     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
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f195387/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/QueuePlacementRule.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/QueuePlacementRule.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/QueuePlacementRule.java
index f2e32e6..2c4add4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/QueuePlacementRule.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/QueuePlacementRule.java
@@ -146,7 +146,11 @@ public abstract class QueuePlacementRule {
     protected String getQueueForApp(String requestedQueue, String user,
         Groups groups, Map<FSQueueType, Set<String>> configuredQueues)
         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

http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f195387/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestQueuePlacementPolicy.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestQueuePlacementPolicy.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestQueuePlacementPolicy.java
index 32dba5c..0dbc99b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestQueuePlacementPolicy.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestQueuePlacementPolicy.java
@@ -19,8 +19,11 @@ package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair;
 
 import static org.junit.Assert.*;
 
+import java.io.IOException;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -393,6 +396,21 @@ public class TestQueuePlacementPolicy {
         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 {
     // Read and parse the allocations file.
     DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory


Mime
View raw message