hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1153438 - in /hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src: main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/ main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/ m...
Date Wed, 03 Aug 2011 11:40:27 GMT
Author: vinodkv
Date: Wed Aug  3 11:40:27 2011
New Revision: 1153438

URL: http://svn.apache.org/viewvc?rev=1153438&view=rev
Log:
Tests for container cleanup events in TestApplicationCleanup and related fixes.

Modified:
    hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java
    hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java
    hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeCleanContainerEvent.java
    hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationCleanup.java

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java?rev=1153438&r1=1153437&r2=1153438&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java
Wed Aug  3 11:40:27 2011
@@ -171,7 +171,7 @@ public class RMAppImpl implements RMApp 
 
   @Override
   public ApplicationId getApplicationId() {
-    return this.getApplicationId();
+    return this.applicationId;
   }
 
   @Override

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java?rev=1153438&r1=1153437&r2=1153438&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java
Wed Aug  3 11:40:27 2011
@@ -351,6 +351,8 @@ public class RMAppAttemptImpl implements
       for (Container cont : newlyAllocatedContainers) {
         ranNodes.add(cont.getNodeId());//add to the nodes set when these containers
         //are pulled by AM
+        eventHandler.handle(
+            new RMContainerEvent(cont.getId(), RMContainerEventType.ACQUIRED));
       }
       this.newlyAllocatedContainers.clear();
       return returnList;

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeCleanContainerEvent.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeCleanContainerEvent.java?rev=1153438&r1=1153437&r2=1153438&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeCleanContainerEvent.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeCleanContainerEvent.java
Wed Aug  3 11:40:27 2011
@@ -8,7 +8,7 @@ public class RMNodeCleanContainerEvent e
   private ContainerId contId;
 
   public RMNodeCleanContainerEvent(NodeId nodeId, ContainerId contId) {
-    super(nodeId, RMNodeEventType.CLEANUP_APP);
+    super(nodeId, RMNodeEventType.CLEANUP_CONTAINER);
     this.contId = contId;
   }
 

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationCleanup.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationCleanup.java?rev=1153438&r1=1153437&r2=1153438&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationCleanup.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationCleanup.java
Wed Aug  3 11:40:27 2011
@@ -5,9 +5,11 @@ import java.util.List;
 
 import junit.framework.Assert;
 
+import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.ResourceRequest;
+import org.apache.hadoop.yarn.server.api.records.HeartbeatResponse;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
@@ -60,13 +62,25 @@ public class TestApplicationCleanup {
     am.unregisterAppAttempt();
     am.waitForState(RMAppAttemptState.FINISHED);
 
-    int size = nm1.nodeHeartbeat(true).getApplicationsToCleanupList().size();
-    while(size < 1) {
+    int cleanedConts = 0;
+    int cleanedApps = 0;
+    List<ContainerId> contsToClean = null;
+    List<ApplicationId> apps = null;
+    
+    //currently only containers are cleaned via this
+    //AM container is cleaned via container launcher
+    while (cleanedConts < 2 || cleanedApps < 1) {
+      HeartbeatResponse resp = nm1.nodeHeartbeat(true);
+      contsToClean = resp.getContainersToCleanupList();
+      apps = resp.getApplicationsToCleanupList();
+      Log.info("Waiting to get cleanup events.." + cleanedConts);
+      cleanedConts += contsToClean.size();
+      cleanedApps += apps.size();
       Thread.sleep(1000);
-      Log.info("Waiting to get application cleanup..");
-      size = nm1.nodeHeartbeat(true).getApplicationsToCleanupList().size();
     }
-    Assert.assertEquals(1, size);
+    
+    Assert.assertEquals(1, apps.size());
+    Assert.assertEquals(app.getApplicationId(), apps.get(0));
 
     rm.stop();
   }



Mime
View raw message