hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wan...@apache.org
Subject hadoop git commit: YARN-4890. Unit test intermittent failure: TestNodeLabelContainerAllocation#testQueueUsedCapacitiesUpdate. (Sunil G via wangda)
Date Thu, 21 Apr 2016 00:38:06 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 63ac2db59 -> 33fd95a99


YARN-4890. Unit test intermittent failure: TestNodeLabelContainerAllocation#testQueueUsedCapacitiesUpdate.
(Sunil G via wangda)


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

Branch: refs/heads/trunk
Commit: 33fd95a99c4df6c4de6b0a53dc6679f3cab629e0
Parents: 63ac2db
Author: Wangda Tan <wangda@apache.org>
Authored: Wed Apr 20 17:37:38 2016 -0700
Committer: Wangda Tan <wangda@apache.org>
Committed: Wed Apr 20 17:37:38 2016 -0700

----------------------------------------------------------------------
 .../TestNodeLabelContainerAllocation.java       | 26 +++++++++++++++-----
 1 file changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/33fd95a9/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestNodeLabelContainerAllocation.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/capacity/TestNodeLabelContainerAllocation.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestNodeLabelContainerAllocation.java
index dc74593..bf389b0 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestNodeLabelContainerAllocation.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestNodeLabelContainerAllocation.java
@@ -50,6 +50,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerAppRepor
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptRemovedSchedulerEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent;
 import org.junit.Assert;
@@ -1260,7 +1261,18 @@ public class TestNodeLabelContainerAllocation {
       totalWaitTick--;
     }
   }
-  
+
+  private void waitSchedulerNodeHasUpdatedLabels(CapacityScheduler cs,
+      MockNM nm, String partition) throws InterruptedException {
+    FiCaSchedulerNode node = cs.getNode(nm.getNodeId());
+    int totalWaitTick = 20; // wait 2 sec at most.
+    while (!node.getLabels().contains(partition)
+        && totalWaitTick > 0) {
+      Thread.sleep(100);
+      totalWaitTick--;
+    }
+  }
+
   @Test
   public void testQueueUsedCapacitiesUpdate()
           throws Exception {
@@ -1450,11 +1462,13 @@ public class TestNodeLabelContainerAllocation {
     // Add nm3/nm4, double resource for both partitioned/non-partitioned
     // resource, used capacity should be 1/2 of before
     mgr.addLabelsToNode(ImmutableMap.of(NodeId.newInstance("h3", 0), toSet("x")));
-    rm.registerNode("h3:1234", 10 * GB); // label = x
-    rm.registerNode("h4:1234", 10 * GB); // label = <empty>
-    
+    MockNM nm3 = rm.registerNode("h3:1234", 10 * GB); // label = x
+    MockNM nm4 = rm.registerNode("h4:1234", 10 * GB); // label = <empty>
+
     waitSchedulerNodeJoined(rm, 4);
-    
+    waitSchedulerNodeHasUpdatedLabels(cs, nm3, "x");
+    waitSchedulerNodeHasUpdatedLabels(cs, nm4, "");
+
     checkQueueUsedCapacity("a", cs, "x", 0.3f, 0.15f);
     checkQueueUsedCapacity("a", cs, "", 0.3f, 0.15f);
     checkQueueUsedCapacity("a1", cs, "x", 0.4f, 0.1f);
@@ -1502,7 +1516,7 @@ public class TestNodeLabelContainerAllocation {
 
     rm.close();
   }
-  
+
   @Test
   public void testOrderOfAllocationOnPartitions()
           throws Exception {


Mime
View raw message