hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rohithsharm...@apache.org
Subject hadoop git commit: YARN-4607. Pagination support for AppAttempt page TotalOutstandingResource Requests table. Contributed by Bibin A Chundatt
Date Mon, 04 Apr 2016 02:41:10 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 0ecdd4cff -> 1e6f92977


YARN-4607. Pagination support for AppAttempt page TotalOutstandingResource Requests table.
Contributed by Bibin A Chundatt


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

Branch: refs/heads/trunk
Commit: 1e6f92977dc5431b117745feb5a3491e88a559c0
Parents: 0ecdd4c
Author: Rohith Sharma K S <rohithsharmaks@apache.org>
Authored: Mon Apr 4 08:09:29 2016 +0530
Committer: Rohith Sharma K S <rohithsharmaks@apache.org>
Committed: Mon Apr 4 08:09:29 2016 +0530

----------------------------------------------------------------------
 .../hadoop/yarn/server/webapp/WebPageUtils.java |  6 ++
 .../resourcemanager/webapp/AppAttemptPage.java  |  4 +-
 .../webapp/RMAppAttemptBlock.java               | 61 ++++++++++++--------
 3 files changed, 45 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/1e6f9297/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.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/WebPageUtils.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.java
index a07baa2..3a26ae5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebPageUtils.java
@@ -95,4 +95,10 @@ public class WebPageUtils {
       .append(", 'mRender': parseHadoopID }]").toString();
   }
 
+  public static String resourceRequestsTableInit() {
+    return tableInit().append(", 'aaData': resourceRequestsTableData")
+        .append(", bDeferRender: true").append(", bProcessing: true}")
+        .toString();
+  }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/1e6f9297/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppAttemptPage.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/AppAttemptPage.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppAttemptPage.java
index df5fb9e..45f1887 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppAttemptPage.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppAttemptPage.java
@@ -41,8 +41,10 @@ public class AppAttemptPage extends RmView {
           : join("Application Attempt ",
             $(YarnWebParams.APPLICATION_ATTEMPT_ID)));
 
-    set(DATATABLES_ID, "containers");
+    set(DATATABLES_ID, "containers resourceRequests");
     set(initID(DATATABLES, "containers"), WebPageUtils.containersTableInit());
+    set(initID(DATATABLES, "resourceRequests"),
+        WebPageUtils.resourceRequestsTableInit());
     setTableStyles(html, "containers", ".queue {width:6em}", ".ui {width:8em}");
 
     set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.RM_WEB_UI);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/1e6f9297/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 668269e..6fef367 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
@@ -26,6 +26,7 @@ import static org.apache.hadoop.yarn.webapp.view.JQueryUI._TH;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
@@ -46,6 +47,7 @@ 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;
 
@@ -75,35 +77,44 @@ public class RMAppAttemptBlock extends AppAttemptBlock{
     }
 
     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").
-    _();
+    // Requests Table
+    TBODY<TABLE<DIV<Hamlet>>> tbody = div
+        .h3("Total Outstanding Resource Requests: "
+            + getTotalResource(resourceRequests))
+        .table("#resourceRequests").thead().tr().th(".priority", "Priority")
+        .th(".resource", "ResourceName").th(".capacity", "Capability")
+        .th(".containers", "NumContainers")
+        .th(".relaxlocality", "RelaxLocality")
+        .th(".labelexpression", "NodeLabelExpression")._()._().tbody();
 
-    boolean odd = false;
-    for (ResourceRequest request : resourceRequests) {
-      if (request.getNumContainers() == 0) {
+    StringBuilder resourceRequestTableData = new StringBuilder("[\n");
+    for (ResourceRequest resourceRequest : resourceRequests) {
+      if (resourceRequest.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())._();
+      resourceRequestTableData.append("[\"")
+          .append(String.valueOf(resourceRequest.getPriority())).append("\",\"")
+          .append(resourceRequest.getResourceName()).append("\",\"")
+          .append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils
+              .escapeHtml(String.valueOf(resourceRequest.getCapability()))))
+          .append("\",\"")
+          .append(String.valueOf(resourceRequest.getNumContainers()))
+          .append("\",\"")
+          .append(String.valueOf(resourceRequest.getRelaxLocality()))
+          .append("\",\"")
+          .append(resourceRequest.getNodeLabelExpression() == null ? "N/A"
+              : resourceRequest.getNodeLabelExpression())
+          .append("\"],\n");
     }
-    table._();
+    if (resourceRequestTableData
+        .charAt(resourceRequestTableData.length() - 2) == ',') {
+      resourceRequestTableData.delete(resourceRequestTableData.length() - 2,
+          resourceRequestTableData.length() - 1);
+    }
+    resourceRequestTableData.append("]");
+    html.script().$type("text/javascript")
+        ._("var resourceRequestsTableData=" + resourceRequestTableData)._();
+    tbody._()._();
     div._();
   }
 


Mime
View raw message