hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1179232 - in /hadoop/common/branches/branch-0.23/hadoop-mapreduce-project: ./ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/ hadoop-yarn/hadoop-yarn-...
Date Wed, 05 Oct 2011 14:07:09 GMT
Author: vinodkv
Date: Wed Oct  5 14:07:08 2011
New Revision: 1179232

URL: http://svn.apache.org/viewvc?rev=1179232&view=rev
Log:
MAPREDUCE-2738. svn merge -c r1179229 --ignore-ancestry ../../trunk/

Added:
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AboutBlock.java
      - copied unchanged from r1179229, hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AboutBlock.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AboutPage.java
      - copied unchanged from r1179229, hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AboutPage.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlockWithMetrics.java
      - copied unchanged from r1179229, hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlockWithMetrics.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/MetricsOverviewTable.java
      - copied unchanged from r1179229, hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/MetricsOverviewTable.java
Removed:
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/InfoPage.java
Modified:
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/DefaultSchedulerPage.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmView.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestNodesPage.java
    hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt Wed Oct  5 14:07:08
2011
@@ -319,6 +319,9 @@ Release 0.23.0 - Unreleased
     the outputs of tasks from a crashed job so as to support MR Application
     Master recovery. (Sharad Agarwal and Arun C Murthy via vinodkv)
 
+    MAPREDUCE-2738. Added the missing cluster level statisticss on the RM web
+    UI. (Robert Joseph Evans via vinodkv)
+
   OPTIMIZATIONS
 
     MAPREDUCE-2026. Make JobTracker.getJobCounters() and

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java
Wed Oct  5 14:07:08 2011
@@ -110,7 +110,7 @@ public class QueueMetrics {
         "Metrics for queue: " + queueName, metrics);
   }
 
-  synchronized QueueMetrics getUserMetrics(String userName) {
+  public synchronized QueueMetrics getUserMetrics(String userName) {
     if (users == null) {
       return null;
     }

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java
Wed Oct  5 14:07:08 2011
@@ -99,7 +99,8 @@ public interface YarnScheduler extends E
   /**
    * Get node resource usage report.
    * @param nodeId
-   * @return the {@link SchedulerNodeReport} for the node
+   * @return the {@link SchedulerNodeReport} for the node or null
+   * if nodeId does not point to a defined node.
    */
   @LimitedPrivate("yarn")
   @Stable

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java
Wed Oct  5 14:07:08 2011
@@ -173,14 +173,6 @@ public class FifoScheduler implements Re
     }
   };
 
-  public synchronized Resource getUsedResource(NodeId nodeId) {
-    return getNode(nodeId).getUsedResource();
-  }
-
-  public synchronized Resource getAvailableResource(NodeId nodeId) {
-    return getNode(nodeId).getAvailableResource();
-  }
-
   @Override
   public Resource getMinimumResourceCapability() {
     return minimumAllocation;
@@ -718,6 +710,9 @@ public class FifoScheduler implements Re
 
     // Inform the node
     node.releaseContainer(container);
+    
+    // Update total usage
+    Resources.subtractFrom(usedResource, container.getResource());
 
     LOG.info("Application " + applicationAttemptId + 
         " released container " + container.getId() +

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java
Wed Oct  5 14:07:08 2011
@@ -31,7 +31,6 @@ import org.apache.hadoop.yarn.webapp.ham
 import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
 
 import static org.apache.hadoop.yarn.util.StringHelper.*;
-import static org.apache.hadoop.yarn.webapp.view.JQueryUI.*;
 
 class CapacitySchedulerPage extends RmView {
   static final String _Q = ".ui-state-default.ui-corner-all";
@@ -96,6 +95,7 @@ class CapacitySchedulerPage extends RmVi
 
     @Override
     public void render(Block html) {
+      html._(MetricsOverviewTable.class);
       UL<DIV<DIV<Hamlet>>> ul = html.
         div("#cs-wrapper.ui-widget").
           div(".ui-widget-header.ui-corner-top").

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/DefaultSchedulerPage.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/DefaultSchedulerPage.java?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/DefaultSchedulerPage.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/DefaultSchedulerPage.java
Wed Oct  5 14:07:08 2011
@@ -19,7 +19,6 @@
 package org.apache.hadoop.yarn.server.resourcemanager.webapp;
 
 import com.google.inject.Inject;
-import com.google.inject.servlet.RequestScoped;
 
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler;
@@ -35,7 +34,6 @@ import org.apache.hadoop.yarn.server.res
 import org.apache.hadoop.yarn.webapp.view.InfoBlock;
 
 import static org.apache.hadoop.yarn.util.StringHelper.*;
-import static org.apache.hadoop.yarn.webapp.view.JQueryUI.*;
 
 class DefaultSchedulerPage extends RmView {
   static final String _Q = ".ui-state-default.ui-corner-all";
@@ -76,8 +74,9 @@ class DefaultSchedulerPage extends RmVie
       int nodeContainers   = 0;
 
       for (RMNode ni : this.rmContext.getRMNodes().values()) {
-        usedNodeMem += fs.getUsedResource(ni.getNodeID()).getMemory();
-        availNodeMem += fs.getAvailableResource(ni.getNodeID()).getMemory();
+        SchedulerNodeReport report = fs.getNodeReport(ni.getNodeID());
+        usedNodeMem += report.getUsedResource().getMemory();
+        availNodeMem += report.getAvailableResource().getMemory();
         totNodeMem += ni.getTotalCapability().getMemory();
         nodeContainers += fs.getNodeReport(ni.getNodeID()).getNumContainers();
       }
@@ -109,6 +108,7 @@ class DefaultSchedulerPage extends RmVie
 
     @Override
     public void render(Block html) {
+      html._(MetricsOverviewTable.class);
       UL<DIV<DIV<Hamlet>>> ul = html.
         div("#cs-wrapper.ui-widget").
           div(".ui-widget-header.ui-corner-top").

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/NodesPage.java
Wed Oct  5 14:07:08 2011
@@ -18,14 +18,21 @@
 
 package org.apache.hadoop.yarn.server.resourcemanager.webapp;
 
+import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWebApp.NODE_STATE;
 import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES;
 import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES_ID;
 import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID;
 import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit;
 
+import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.yarn.api.records.NodeHealthStatus;
+import org.apache.hadoop.yarn.api.records.NodeId;
 import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
 import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
+import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeState;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNodeReport;
 import org.apache.hadoop.yarn.util.Times;
 import org.apache.hadoop.yarn.webapp.SubView;
 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
@@ -38,45 +45,75 @@ import com.google.inject.Inject;
 class NodesPage extends RmView {
 
   static class NodesBlock extends HtmlBlock {
+    private static final long BYTES_IN_MB = 1024 * 1024;
     final RMContext rmContext;
+    final ResourceManager rm;
 
     @Inject
-    NodesBlock(RMContext context, ViewContext ctx) {
+    NodesBlock(RMContext context, ResourceManager rm, ViewContext ctx) {
       super(ctx);
       this.rmContext = context;
+      this.rm = rm;
     }
 
     @Override
     protected void render(Block html) {
+      html._(MetricsOverviewTable.class);
+      
+      ResourceScheduler sched = rm.getResourceScheduler();
+      String type = $(NODE_STATE);
       TBODY<TABLE<Hamlet>> tbody = html.table("#nodes").
           thead().
           tr().
           th(".rack", "Rack").
+          th(".state", "Node State").
           th(".nodeaddress", "Node Address").
           th(".nodehttpaddress", "Node HTTP Address").
           th(".healthStatus", "Health-status").
           th(".lastHealthUpdate", "Last health-update").
           th(".healthReport", "Health-report").
           th(".containers", "Containers").
-//          th(".mem", "Mem Used (MB)").
-//          th(".mem", "Mem Avail (MB)").
+          th(".mem", "Mem Used").
+          th(".mem", "Mem Avail").
           _()._().
           tbody();
+      RMNodeState stateFilter = null;
+      if(type != null && !type.isEmpty()) {
+        stateFilter = RMNodeState.valueOf(type.toUpperCase());
+      }
       for (RMNode ni : this.rmContext.getRMNodes().values()) {
+        if(stateFilter != null) {
+          RMNodeState state = ni.getState();
+          if(!stateFilter.equals(state)) {
+            continue;
+          }
+        }
+        NodeId id = ni.getNodeID();
+        SchedulerNodeReport report = sched.getNodeReport(id);
+        int numContainers = 0;
+        int usedMemory = 0;
+        int availableMemory = 0;
+        if(report != null) {
+          numContainers = report.getNumContainers();
+          usedMemory = report.getUsedResource().getMemory();
+          availableMemory = report.getAvailableResource().getMemory();
+        }
+
         NodeHealthStatus health = ni.getNodeHealthStatus();
         tbody.tr().
             td(ni.getRackName()).
+            td(String.valueOf(ni.getState())).
             td(String.valueOf(ni.getNodeID().toString())).
             td().a("http://" + ni.getHttpAddress(), ni.getHttpAddress())._().
             td(health.getIsNodeHealthy() ? "Healthy" : "Unhealthy").
             td(Times.format(health.getLastHealthReportTime())).
             td(String.valueOf(health.getHealthReport())).
-            // TODO: acm: refactor2 FIXME
-            //td(String.valueOf(ni.getNumContainers())).
-            // TODO: FIXME Vinodkv
-//            td(String.valueOf(ni.getUsedResource().getMemory())).
-//            td(String.valueOf(ni.getAvailableResource().getMemory())).
-            td("n/a")._();
+            td(String.valueOf(numContainers)).
+            td().br().$title(String.valueOf(usedMemory))._().
+              _(StringUtils.byteDesc(usedMemory * BYTES_IN_MB))._().
+            td().br().$title(String.valueOf(usedMemory))._().
+              _(StringUtils.byteDesc(availableMemory * BYTES_IN_MB))._().
+            _();
       }
       tbody._()._();
     }
@@ -84,7 +121,12 @@ class NodesPage extends RmView {
 
   @Override protected void preHead(Page.HTML<_> html) {
     commonPreHead(html);
-    setTitle("Nodes of the cluster");
+    String type = $(NODE_STATE);
+    String title = "Nodes of the cluster";
+    if(type != null && !type.isEmpty()) {
+      title = title+" ("+type+")";
+    }
+    setTitle(title);
     set(DATATABLES_ID, "nodes");
     set(initID(DATATABLES, "nodes"), nodesTableInit());
     setTableStyles(html, "nodes", ".healthStatus {width:10em}",
@@ -96,11 +138,10 @@ class NodesPage extends RmView {
   }
 
   private String nodesTableInit() {
-    return tableInit().
-        // rack, nodeid, host, healthStatus, health update ts, health report,
-        // containers, memused, memavail
-        append(", aoColumns:[null, null, null, null, null, null, ").
-        append("{sType:'title-numeric', bSearchable:false}]}").
-        toString();
+    StringBuilder b = tableInit().append(",aoColumnDefs:[");
+    b.append("{'bSearchable':false, 'aTargets': [7]} ,");
+    b.append("{'sType':'title-numeric', 'bSearchable':false, " +
+    		"'aTargets': [ 8, 9] }]}");
+    return b.toString();
   }
 }

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java
Wed Oct  5 14:07:08 2011
@@ -30,6 +30,7 @@ import org.apache.hadoop.yarn.webapp.Web
 public class RMWebApp extends WebApp {
   static final String APP_ID = "app.id";
   static final String QUEUE_NAME = "queue.name";
+  static final String NODE_STATE = "node.state";
 
   private final ResourceManager rm;
 
@@ -44,9 +45,9 @@ public class RMWebApp extends WebApp {
       bind(RMContext.class).toInstance(rm.getRMContext());
     }
     route("/", RmController.class);
-    route("/nodes", RmController.class, "nodes");
+    route(pajoin("/nodes", NODE_STATE), RmController.class, "nodes");
     route("/apps", RmController.class);
-    route("/cluster", RmController.class, "info");
+    route("/cluster", RmController.class, "about");
     route(pajoin("/app", APP_ID), RmController.class, "app");
     route("/scheduler", RmController.class, "scheduler");
     route(pajoin("/queue", QUEUE_NAME), RmController.class, "queue");

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java
Wed Oct  5 14:07:08 2011
@@ -22,8 +22,9 @@ import static org.apache.hadoop.yarn.ser
 import static org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWebApp.QUEUE_NAME;
 import static org.apache.hadoop.yarn.util.StringHelper.join;
 
+import javax.servlet.http.HttpServletResponse;
+
 import org.apache.hadoop.util.StringUtils;
-import org.apache.hadoop.util.VersionInfo;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
@@ -35,7 +36,6 @@ import org.apache.hadoop.yarn.server.res
 import org.apache.hadoop.yarn.util.Apps;
 import org.apache.hadoop.yarn.util.ConverterUtils;
 import org.apache.hadoop.yarn.util.Times;
-import org.apache.hadoop.yarn.util.YarnVersionInfo;
 import org.apache.hadoop.yarn.webapp.Controller;
 import org.apache.hadoop.yarn.webapp.ResponseInfo;
 
@@ -50,25 +50,15 @@ public class RmController extends Contro
     setTitle("Applications");
   }
 
-  public void info() {
+  public void about() {
     setTitle("About the Cluster");
-    long ts = ResourceManager.clusterTimeStamp;
-    ResourceManager rm = getInstance(ResourceManager.class);
-    info("Cluster overview").
-      _("Cluster ID:", ts).
-      _("ResourceManager state:", rm.getServiceState()).
-      _("ResourceManager started on:", Times.format(ts)).
-      _("ResourceManager version:", YarnVersionInfo.getBuildVersion() +
-          " on " + YarnVersionInfo.getDate()).
-      _("Hadoop version:", VersionInfo.getBuildVersion() +
-          " on " + VersionInfo.getDate());
-    render(InfoPage.class);
+    render(AboutPage.class);
   }
 
   public void app() {
     String aid = $(APP_ID);
     if (aid.isEmpty()) {
-      setStatus(response().SC_BAD_REQUEST);
+      setStatus(HttpServletResponse.SC_BAD_REQUEST);
       setTitle("Bad request: requires application ID");
       return;
     }
@@ -77,7 +67,7 @@ public class RmController extends Contro
     RMApp app = context.getRMApps().get(appID);
     if (app == null) {
       // TODO: handle redirect to jobhistory server
-      setStatus(response().SC_NOT_FOUND);
+      setStatus(HttpServletResponse.SC_NOT_FOUND);
       setTitle("Application not found: "+ aid);
       return;
     }
@@ -107,7 +97,7 @@ public class RmController extends Contro
     } else {
       info._("AM container logs:", "AM not yet registered with RM");
     }
-    render(InfoPage.class);
+    render(AboutPage.class);
   }
 
   public void nodes() {

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmView.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmView.java?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmView.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmView.java
Wed Oct  5 14:07:08 2011
@@ -52,7 +52,7 @@ public class RmView extends TwoColumnLay
 
   @Override
   protected Class<? extends SubView> content() {
-    return AppsBlock.class;
+    return AppsBlockWithMetrics.class;
   }
 
   private String appsTableInit() {
@@ -60,7 +60,7 @@ public class RmView extends TwoColumnLay
     // id, user, name, queue, state, progress, ui, note
     StringBuilder init = tableInit().
         append(", aoColumns:[{sType:'title-numeric'}, null, null, null, null,").
-        append("{sType:'title-numeric', bSearchable:false}, null, null]");
+        append("null,{sType:'title-numeric', bSearchable:false}, null, null]");
     String rows = $("rowlimit");
     int rowLimit = rows.isEmpty() ? MAX_DISPLAY_ROWS : Integer.parseInt(rows);
     if (list.apps.size() < rowLimit) {

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestNodesPage.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestNodesPage.java?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestNodesPage.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestNodesPage.java
Wed Oct  5 14:07:08 2011
@@ -17,14 +17,20 @@
  */
 package org.apache.hadoop.yarn.server.resourcemanager.webapp;
 
+import java.io.IOException;
 import java.io.PrintWriter;
 
 import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
 import org.apache.hadoop.yarn.server.resourcemanager.webapp.NodesPage.NodesBlock;
 import org.apache.hadoop.yarn.webapp.test.WebAppTests;
 import org.junit.Test;
 import org.mockito.Mockito;
 
+import com.google.inject.Binder;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+
 /**
  * This tests the NodesPage block table that it should contain the table body
  * data for all the columns in the table as specified in the header.
@@ -33,23 +39,36 @@ public class TestNodesPage {
 
   @Test
   public void testNodesBlockRender() throws Exception {
-    int numberOfRacks = 2;
-    int numberOfNodesPerRack = 2;
+    final int numberOfRacks = 2;
+    final int numberOfNodesPerRack = 2;
     // Number of Actual Table Headers for NodesPage.NodesBlock might change in
     // future. In that case this value should be adjusted to the new value.
-    int numberOfActualTableHeaders = 7;
+    final int numberOfThInMetricsTable = 9;
+    final int numberOfActualTableHeaders = 10;
 
-    PrintWriter writer = WebAppTests.testBlock(
-        NodesBlock.class,
-        RMContext.class,
-        TestRMWebApp.mockRMContext(3, numberOfRacks, numberOfNodesPerRack,
-            8 * TestRMWebApp.GiB)).getInstance(PrintWriter.class);
+    Injector injector = WebAppTests.createMockInjector(RMContext.class,
+        TestRMWebApp.mockRMContext(3, numberOfRacks, numberOfNodesPerRack, 8*TestRMWebApp.GiB),
+        new Module() {
+      @Override
+      public void configure(Binder binder) {
+        try {
+          binder.bind(ResourceManager.class).toInstance(TestRMWebApp.mockRm(3,
+              numberOfRacks, numberOfNodesPerRack, 8*TestRMWebApp.GiB));
+        } catch (IOException e) {
+          throw new IllegalStateException(e);
+        }
+      }
+    });
+    injector.getInstance(NodesBlock.class).render();
+    PrintWriter writer = injector.getInstance(PrintWriter.class);
+    WebAppTests.flushOutput(injector);
 
-    Mockito.verify(writer, Mockito.times(numberOfActualTableHeaders)).print(
+    Mockito.verify(writer, Mockito.times(numberOfActualTableHeaders + 
+        numberOfThInMetricsTable)).print(
         "<th");
     Mockito.verify(
         writer,
         Mockito.times(numberOfRacks * numberOfNodesPerRack
-            * numberOfActualTableHeaders)).print("<td");
+            * numberOfActualTableHeaders + numberOfThInMetricsTable)).print("<td");
   }
 }

Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java?rev=1179232&r1=1179231&r2=1179232&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java
Wed Oct  5 14:07:08 2011
@@ -24,10 +24,10 @@ import static org.junit.Assert.assertEqu
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.ConcurrentMap;
 
-import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.NodeId;
 import org.apache.hadoop.yarn.server.resourcemanager.MockNodes;
@@ -37,7 +37,6 @@ import org.apache.hadoop.yarn.server.res
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.MockAsm;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemStore;
 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.rmnode.RMNode;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
@@ -48,7 +47,9 @@ import org.apache.hadoop.yarn.webapp.tes
 import org.junit.Test;
 
 import com.google.common.collect.Maps;
+import com.google.inject.Binder;
 import com.google.inject.Injector;
+import com.google.inject.Module;
 
 public class TestRMWebApp {
   static final int GiB = 1024; // MiB
@@ -62,14 +63,36 @@ public class TestRMWebApp {
 
   @Test public void testView() {
     Injector injector = WebAppTests.createMockInjector(RMContext.class,
-                                               mockRMContext(3, 1, 2, 8*GiB));
+        mockRMContext(3, 1, 2, 8*GiB),
+        new Module() {
+      @Override
+      public void configure(Binder binder) {
+        try {
+          binder.bind(ResourceManager.class).toInstance(mockRm(3, 1, 2, 8*GiB));
+        } catch (IOException e) {
+          throw new IllegalStateException(e);
+        }
+      }
+    });
     injector.getInstance(RmView.class).render();
     WebAppTests.flushOutput(injector);
   }
 
   @Test public void testNodesPage() {
-    WebAppTests.testPage(NodesPage.class, RMContext.class,
-                         mockRMContext(3, 1, 2, 8*GiB));
+    Injector injector = WebAppTests.createMockInjector(RMContext.class,
+        mockRMContext(3, 1, 2, 8*GiB),
+        new Module() {
+      @Override
+      public void configure(Binder binder) {
+        try {
+          binder.bind(ResourceManager.class).toInstance(mockRm(3, 1, 2, 8*GiB));
+        } catch (IOException e) {
+          throw new IllegalStateException(e);
+        }
+      }
+    });
+    injector.getInstance(NodesPage.class).render();
+    WebAppTests.flushOutput(injector);
   }
 
   public static RMContext mockRMContext(int numApps, int racks, int numNodes,
@@ -99,8 +122,7 @@ public class TestRMWebApp {
   }
 
   public static ResourceManager mockRm(int apps, int racks, int nodes,
-                                       int mbsPerNode)
-  throws Exception {
+                                       int mbsPerNode) throws IOException {
     ResourceManager rm = mock(ResourceManager.class);
     RMContext rmContext = mockRMContext(apps, racks, nodes,
         mbsPerNode);
@@ -110,7 +132,7 @@ public class TestRMWebApp {
     return rm;
   }
 
-  public static CapacityScheduler mockCapacityScheduler() throws Exception {
+  public static CapacityScheduler mockCapacityScheduler() throws IOException {
     // stolen from TestCapacityScheduler
     CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
     setupQueueConfiguration(conf);



Mime
View raw message