Pārlūkot izejas kodu

YARN-1451. TestResourceManager relies on the scheduler assigning multiple containers in a single node update. (Sandy Ryza via kasha)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1551440 13f79535-47bb-0310-9956-ffa450edef68
Karthik Kambatla 11 gadi atpakaļ
vecāks
revīzija
a6754bbb81

+ 3 - 0
hadoop-yarn-project/CHANGES.txt

@@ -255,6 +255,9 @@ Release 2.4.0 - UNRELEASED
     YARN-1145. Fixed a potential file-handle leak in the web interface for
     YARN-1145. Fixed a potential file-handle leak in the web interface for
     displaying aggregated logs. (Rohith Sharma via vinodkv)
     displaying aggregated logs. (Rohith Sharma via vinodkv)
 
 
+    YARN-1451. TestResourceManager relies on the scheduler assigning multiple
+    containers in a single node update. (Sandy Ryza via kasha)
+
 Release 2.3.0 - UNRELEASED
 Release 2.3.0 - UNRELEASED
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 7 - 4
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceManager.java

@@ -79,22 +79,23 @@ public class TestResourceManager {
 
 
   @Test
   @Test
   public void testResourceAllocation() throws IOException,
   public void testResourceAllocation() throws IOException,
-      YarnException {
+      YarnException, InterruptedException {
     LOG.info("--- START: testResourceAllocation ---");
     LOG.info("--- START: testResourceAllocation ---");
         
         
     final int memory = 4 * 1024;
     final int memory = 4 * 1024;
+    final int vcores = 4;
     
     
     // Register node1
     // Register node1
     String host1 = "host1";
     String host1 = "host1";
     org.apache.hadoop.yarn.server.resourcemanager.NodeManager nm1 = 
     org.apache.hadoop.yarn.server.resourcemanager.NodeManager nm1 = 
       registerNode(host1, 1234, 2345, NetworkTopology.DEFAULT_RACK, 
       registerNode(host1, 1234, 2345, NetworkTopology.DEFAULT_RACK, 
-          Resources.createResource(memory, 1));
+          Resources.createResource(memory, vcores));
     
     
     // Register node2
     // Register node2
     String host2 = "host2";
     String host2 = "host2";
     org.apache.hadoop.yarn.server.resourcemanager.NodeManager nm2 = 
     org.apache.hadoop.yarn.server.resourcemanager.NodeManager nm2 = 
       registerNode(host2, 1234, 2345, NetworkTopology.DEFAULT_RACK, 
       registerNode(host2, 1234, 2345, NetworkTopology.DEFAULT_RACK, 
-          Resources.createResource(memory/2, 1));
+          Resources.createResource(memory/2, vcores/2));
 
 
     // Submit an application
     // Submit an application
     Application application = new Application("user1", resourceManager);
     Application application = new Application("user1", resourceManager);
@@ -142,8 +143,10 @@ public class TestResourceManager {
     application.schedule();
     application.schedule();
     checkResourceUsage(nm1, nm2);
     checkResourceUsage(nm1, nm2);
     
     
-    // Send a heartbeat to kick the tires on the Scheduler
+    // Send heartbeats to kick the tires on the Scheduler
     nodeUpdate(nm2);
     nodeUpdate(nm2);
+    nodeUpdate(nm2);
+    nodeUpdate(nm1);
     nodeUpdate(nm1);
     nodeUpdate(nm1);
     
     
     // Get allocations from the scheduler
     // Get allocations from the scheduler