hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r1175351 - in /hadoop/common/trunk/hadoop-mapreduce-project: ./ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/ hadoop-yarn/hadoop-yarn-server/hadoop-yarn...
Date Sun, 25 Sep 2011 09:36:13 GMT
Author: acmurthy
Date: Sun Sep 25 09:36:12 2011
New Revision: 1175351

URL: http://svn.apache.org/viewvc?rev=1175351&view=rev
Log:
MAPREDUCE-2990. Fixed display of NodeHealthStatus. Contributed by Subroto Sanyal.

Modified:
    hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt
    hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java
    hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceManager.java

Modified: hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt?rev=1175351&r1=1175350&r2=1175351&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt Sun Sep 25 09:36:12 2011
@@ -1409,6 +1409,9 @@ Release 0.23.0 - Unreleased
     MAPREDUCE-2691. Increase threadpool size for launching containers in
     MapReduce ApplicationMaster. (vinodkv via acmurthy)
 
+    MAPREDUCE-2990. Fixed display of NodeHealthStatus. (Subroto Sanyal via
+    acmurthy) 
+
 Release 0.22.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java?rev=1175351&r1=1175350&r2=1175351&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java
(original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java
Sun Sep 25 09:36:12 2011
@@ -147,6 +147,7 @@ public class RMNodeImpl implements RMNod
     this.httpAddress = hostName + ":" + httpPort;;
     this.node = node;
     this.nodeHealthStatus.setIsNodeHealthy(true);
+    this.nodeHealthStatus.setHealthReport("Healthy");
     this.nodeHealthStatus.setLastHealthReportTime(System.currentTimeMillis());
 
     this.latestHeartBeatResponse.setResponseId(0);
@@ -222,6 +223,18 @@ public class RMNodeImpl implements RMNod
     }
   }
 
+  private void setNodeHealthStatus(NodeHealthStatus status)
+  {
+    this.writeLock.lock();
+    try {
+      this.nodeHealthStatus.setHealthReport(status.getHealthReport());
+      this.nodeHealthStatus.setIsNodeHealthy(status.getIsNodeHealthy());
+      this.nodeHealthStatus.setLastHealthReportTime(status.getLastHealthReportTime());
+    } finally {
+      this.writeLock.unlock();
+    }
+  }
+
   @Override
   public RMNodeState getState() {
     this.readLock.lock();
@@ -345,7 +358,10 @@ public class RMNodeImpl implements RMNod
       // Switch the last heartbeatresponse.
       rmNode.latestHeartBeatResponse = statusEvent.getLatestResponse();
 
-      if (!statusEvent.getNodeHealthStatus().getIsNodeHealthy()) {
+      NodeHealthStatus remoteNodeHealthStatus = 
+          statusEvent.getNodeHealthStatus();
+      rmNode.setNodeHealthStatus(remoteNodeHealthStatus);
+      if (!remoteNodeHealthStatus.getIsNodeHealthy()) {
         // Inform the scheduler
         rmNode.context.getDispatcher().getEventHandler().handle(
             new NodeRemovedSchedulerEvent(rmNode));
@@ -392,8 +408,9 @@ public class RMNodeImpl implements RMNod
 
       // Switch the last heartbeatresponse.
       rmNode.latestHeartBeatResponse = statusEvent.getLatestResponse();
-
-      if (statusEvent.getNodeHealthStatus().getIsNodeHealthy()) {
+      NodeHealthStatus remoteNodeHealthStatus = statusEvent.getNodeHealthStatus();
+      rmNode.setNodeHealthStatus(remoteNodeHealthStatus);
+      if (remoteNodeHealthStatus.getIsNodeHealthy()) {
         rmNode.context.getDispatcher().getEventHandler().handle(
             new NodeAddedSchedulerEvent(rmNode));
         return RMNodeState.RUNNING;

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceManager.java?rev=1175351&r1=1175350&r2=1175351&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceManager.java
(original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceManager.java
Sun Sep 25 09:36:12 2011
@@ -18,12 +18,16 @@
 
 package org.apache.hadoop.yarn.server.resourcemanager;
 
+import static org.junit.Assert.assertNotNull;
+
 import java.io.IOException;
+import java.util.Collection;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.net.NetworkTopology;
+import org.apache.hadoop.yarn.api.records.NodeHealthStatus;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.Store;
@@ -153,6 +157,23 @@ public class TestResourceManager {
     
     LOG.info("--- END: testResourceAllocation ---");
   }
+  
+  @Test
+  public void testNodeHealthReportIsNotNull() throws Exception{
+    String host1 = "host1";
+    final int memory = 4 * 1024;
+    org.apache.hadoop.yarn.server.resourcemanager.NodeManager nm1 = 
+      registerNode(host1, 1234, 2345, NetworkTopology.DEFAULT_RACK, memory);
+    nm1.heartbeat();
+    nm1.heartbeat();
+    Collection<RMNode> values = resourceManager.getRMContext().getRMNodes().values();
+    for (RMNode ni : values)
+    {
+      NodeHealthStatus nodeHealthStatus = ni.getNodeHealthStatus();
+      String healthReport = nodeHealthStatus.getHealthReport();
+      assertNotNull(healthReport);
+    }
+  }
 
   private void checkResourceUsage(
       org.apache.hadoop.yarn.server.resourcemanager.NodeManager... nodes ) {



Mime
View raw message