hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jia...@apache.org
Subject hadoop git commit: YARN-3301. Fixed the format issue of the new RM attempt web page. Contributed by Xuan Gong (cherry picked from commit 0d3188fd25f31b83caf16b77773620f4ee237409)
Date Wed, 06 May 2015 20:51:47 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 f79b1f019 -> f8488b5ae


YARN-3301. Fixed the format issue of the new RM attempt web page. Contributed by Xuan Gong
(cherry picked from commit 0d3188fd25f31b83caf16b77773620f4ee237409)


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

Branch: refs/heads/branch-2
Commit: f8488b5aeb89449f749d8b8c13b3d3a2ce65a1a9
Parents: f79b1f0
Author: Jian He <jianhe@apache.org>
Authored: Wed May 6 13:45:00 2015 -0700
Committer: Jian He <jianhe@apache.org>
Committed: Wed May 6 13:51:44 2015 -0700

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                 |  3 +
 .../yarn/server/webapp/AppAttemptBlock.java     |  6 ++
 .../webapp/RMAppAttemptBlock.java               | 97 ++++++++++++--------
 3 files changed, 68 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/f8488b5a/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index a35a6c4..94301e7 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -323,6 +323,9 @@ Release 2.7.1 - UNRELEASED
     YARN-3544. Got back AM logs link on the RM web UI for a completed app.
     (Xuan Gong via zjshen)
 
+    YARN-3301. Fixed the format issue of the new RM attempt web page.
+    (Xuan Gong via jianhe)
+
 Release 2.7.0 - 2015-04-20
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/f8488b5a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java
index d320f4a..9c2a1ae 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java
@@ -149,6 +149,8 @@ public class AppAttemptBlock extends HtmlBlock {
     createAttemptHeadRoomTable(html);
     html._(InfoBlock.class);
 
+    createTablesForAttemptMetrics(html);
+
     // Container Table
     TBODY<TABLE<Hamlet>> tbody =
         html.table("#containers").thead().tr().th(".id", "Container ID")
@@ -236,4 +238,8 @@ public class AppAttemptBlock extends HtmlBlock {
   protected void createAttemptHeadRoomTable(Block html) {
     
   }
+
+  protected void createTablesForAttemptMetrics(Block html) {
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/f8488b5a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppAttemptBlock.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppAttemptBlock.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppAttemptBlock.java
index 6543e92..30f55be 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppAttemptBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppAttemptBlock.java
@@ -46,10 +46,10 @@ import org.apache.hadoop.yarn.util.resource.Resources;
 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV;
 import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE;
-import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY;
 import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
 import org.apache.hadoop.yarn.webapp.view.InfoBlock;
 import com.google.inject.Inject;
+import java.util.List;
 
 import java.util.Collection;
 import java.util.Set;
@@ -66,52 +66,67 @@ public class RMAppAttemptBlock extends AppAttemptBlock{
     this.conf = conf;
   }
 
-  @Override
-  protected void render(Block html) {
-    super.render(html);
-    createContainerLocalityTable(html);
-    createResourceRequestsTable(html);
-  }
-
   private void createResourceRequestsTable(Block html) {
     AppInfo app =
         new AppInfo(rm, rm.getRMContext().getRMApps()
           .get(this.appAttemptId.getApplicationId()), true,
           WebAppUtils.getHttpSchemePrefix(conf));
-    TBODY<TABLE<Hamlet>> tbody =
-        html.table("#ResourceRequests").thead().tr()
-          .th(".priority", "Priority")
-          .th(".resourceName", "ResourceName")
-          .th(".totalResource", "Capability")
-          .th(".numContainers", "NumContainers")
-          .th(".relaxLocality", "RelaxLocality")
-          .th(".nodeLabelExpression", "NodeLabelExpression")._()._().tbody();
 
+    List<ResourceRequest> resourceRequests = app.getResourceRequests();
+    if (resourceRequests == null || resourceRequests.isEmpty()) {
+      return;
+    }
+
+    DIV<Hamlet> div = html.div(_INFO_WRAP);
+    TABLE<DIV<Hamlet>> table =
+        div.h3("Total Outstanding Resource Requests: "
+          + getTotalResource(resourceRequests)).table(
+              "#ResourceRequests");
+
+    table.tr().
+      th(_TH, "Priority").
+      th(_TH, "ResourceName").
+      th(_TH, "Capability").
+      th(_TH, "NumContainers").
+      th(_TH, "RelaxLocality").
+      th(_TH, "NodeLabelExpression").
+    _();
+
+    boolean odd = false;
+    for (ResourceRequest request : resourceRequests) {
+      if (request.getNumContainers() == 0) {
+        continue;
+      }
+      table.tr((odd = !odd) ? _ODD : _EVEN)
+        .td(String.valueOf(request.getPriority()))
+        .td(request.getResourceName())
+        .td(String.valueOf(request.getCapability()))
+        .td(String.valueOf(request.getNumContainers()))
+        .td(String.valueOf(request.getRelaxLocality()))
+        .td(request.getNodeLabelExpression() == null ? "N/A" : request
+            .getNodeLabelExpression())._();
+    }
+    table._();
+    div._();
+  }
+
+  private Resource getTotalResource(List<ResourceRequest> requests) {
     Resource totalResource = Resource.newInstance(0, 0);
-    if (app.getResourceRequests() != null) {
-      for (ResourceRequest request : app.getResourceRequests()) {
-        if (request.getNumContainers() == 0) {
-          continue;
-        }
-
-        tbody.tr()
-          .td(String.valueOf(request.getPriority()))
-          .td(request.getResourceName())
-          .td(String.valueOf(request.getCapability()))
-          .td(String.valueOf(request.getNumContainers()))
-          .td(String.valueOf(request.getRelaxLocality()))
-          .td(request.getNodeLabelExpression() == null ? "N/A" : request
-              .getNodeLabelExpression())._();
-        if (request.getResourceName().equals(ResourceRequest.ANY)) {
-          Resources.addTo(totalResource,
-            Resources.multiply(request.getCapability(),
-              request.getNumContainers()));
-        }
+    if (requests == null) {
+      return totalResource;
+    }
+    for (ResourceRequest request : requests) {
+      if (request.getNumContainers() == 0) {
+        continue;
+      }
+      if (request.getResourceName().equals(ResourceRequest.ANY)) {
+        Resources.addTo(
+          totalResource,
+          Resources.multiply(request.getCapability(),
+            request.getNumContainers()));
       }
     }
-    html.div().$class("totalResourceRequests")
-      .h3("Total Outstanding Resource Requests: " + totalResource)._();
-    tbody._()._();
+    return totalResource;
   }
 
   private void createContainerLocalityTable(Block html) {
@@ -248,4 +263,10 @@ public class RMAppAttemptBlock extends AppAttemptBlock{
     }
     return null;
   }
+
+  @Override
+  protected void createTablesForAttemptMetrics(Block html) {
+    createContainerLocalityTable(html);
+    createResourceRequestsTable(html);
+  }
 }


Mime
View raw message