hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject svn commit: r1409580 - in /hadoop/common/trunk/hadoop-mapreduce-project: ./ hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/
Date Thu, 15 Nov 2012 00:01:12 GMT
Author: bobby
Date: Thu Nov 15 00:01:07 2012
New Revision: 1409580

URL: http://svn.apache.org/viewvc?rev=1409580&view=rev
Log:
MAPREDUCE-4720. Browser thinks History Server main page JS is taking too long (Ravi Prakash
via bobby)

Modified:
    hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt
    hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobsBlock.java
    hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTasksBlock.java
    hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTasksPage.java
    hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.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=1409580&r1=1409579&r2=1409580&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt Thu Nov 15 00:01:07 2012
@@ -593,6 +593,9 @@ Release 0.23.5 - UNRELEASED
 
   OPTIMIZATIONS
 
+    MAPREDUCE-4720. Browser thinks History Server main page JS is taking too 
+    long (Ravi Prakash via bobby)
+
   BUG FIXES
 
     MAPREDUCE-4554. Job Credentials are not transmitted if security is turned 

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobsBlock.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobsBlock.java?rev=1409580&r1=1409579&r2=1409580&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobsBlock.java
(original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsJobsBlock.java
Thu Nov 15 00:01:07 2012
@@ -21,6 +21,7 @@ package org.apache.hadoop.mapreduce.v2.h
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.hadoop.mapreduce.v2.app.AppContext;
 import org.apache.hadoop.mapreduce.v2.app.job.Job;
 import org.apache.hadoop.mapreduce.v2.hs.webapp.dao.JobInfo;
@@ -67,22 +68,36 @@ public class HsJobsBlock extends HtmlBlo
             th("Reduces Completed")._()._().
         tbody();
     LOG.info("Getting list of all Jobs.");
+    // Write all the data into a JavaScript array of arrays for JQuery
+    // DataTables to display
+    StringBuilder jobsTableData = new StringBuilder("[\n");
     for (Job j : appContext.getAllJobs().values()) {
       JobInfo job = new JobInfo(j);
-      tbody.
-        tr().
-          td(dateFormat.format(new Date(job.getStartTime()))).
-          td(dateFormat.format(new Date(job.getFinishTime()))).
-          td().a(url("job", job.getId()), job.getId())._().
-          td(job.getName()).
-          td(job.getUserName()).
-          td(job.getQueueName()).
-          td(job.getState()).
-          td(String.valueOf(job.getMapsTotal())).
-          td(String.valueOf(job.getMapsCompleted())).
-          td(String.valueOf(job.getReducesTotal())).
-          td(String.valueOf(job.getReducesCompleted()))._();
+      jobsTableData.append("[\"")
+      .append(dateFormat.format(new Date(job.getStartTime()))).append("\",\"")
+      .append(dateFormat.format(new Date(job.getFinishTime()))).append("\",\"")
+      .append("<a href='").append(url("job", job.getId())).append("'>")
+      .append(job.getId()).append("</a>\",\"")
+      .append(StringEscapeUtils.escapeJavaScript(job.getName()))
+      .append("\",\"")
+      .append(StringEscapeUtils.escapeJavaScript(job.getUserName()))
+      .append("\",\"")
+      .append(StringEscapeUtils.escapeJavaScript(job.getQueueName()))
+      .append("\",\"")
+      .append(job.getState()).append("\",\"")
+      .append(String.valueOf(job.getMapsTotal())).append("\",\"")
+      .append(String.valueOf(job.getMapsCompleted())).append("\",\"")
+      .append(String.valueOf(job.getReducesTotal())).append("\",\"")
+      .append(String.valueOf(job.getReducesCompleted())).append("\"],\n");
     }
+
+    //Remove the last comma and close off the array of arrays
+    if(jobsTableData.charAt(jobsTableData.length() - 2) == ',') {
+      jobsTableData.delete(jobsTableData.length()-2, jobsTableData.length()-1);
+    }
+    jobsTableData.append("]");
+    html.script().$type("text/javascript").
+    _("var jobsTableData=" + jobsTableData)._();
     tbody._().
     tfoot().
       tr().

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTasksBlock.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTasksBlock.java?rev=1409580&r1=1409579&r2=1409580&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTasksBlock.java
(original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTasksBlock.java
Thu Nov 15 00:01:07 2012
@@ -100,6 +100,10 @@ public class HsTasksBlock extends HtmlBl
     theadRow.th("Elapsed Time"); //Attempt
 
     TBODY<TABLE<Hamlet>> tbody = theadRow._()._().tbody();
+
+    // Write all the data into a JavaScript array of arrays for JQuery
+    // DataTables to display
+    StringBuilder tasksTableData = new StringBuilder("[\n");
     for (Task task : app.getJob().getTasks().values()) {
       if (type != null && task.getType() != type) {
         continue;
@@ -137,55 +141,36 @@ public class HsTasksBlock extends HtmlBl
         attemptFinishTime = ta.getFinishTime();
         attemptElapsed = ta.getElapsedTime();
       }
+      tasksTableData.append("[\"")
+      .append("<a href='" + url("task", tid)).append("'>")
+      .append(tid).append("</a>\",\"")
+      .append(info.getState()).append("\",\"")
+      .append(startTime).append("\",\"")
+      .append(finishTime).append("\",\"")
+      .append(elapsed).append("\",\"")
+      .append(attemptStartTime).append("\",\"");
 
-      TR<TBODY<TABLE<Hamlet>>> row = tbody.tr();
-      row.
-          td().
-            br().$title(String.valueOf(info.getTaskNum()))._(). // sorting
-            a(url("task", tid), tid)._().
-          td(info.getState()).
-          td().
-            br().$title(String.valueOf(startTime))._().
-            _(Times.format(startTime))._().
-          td().
-            br().$title(String.valueOf(finishTime))._().
-            _(Times.format(finishTime))._().
-          td().
-            br().$title(String.valueOf(elapsed))._().
-            _(formatTime(elapsed))._().
-          td().
-            br().$title(String.valueOf(attemptStartTime))._().
-            _(Times.format(attemptStartTime))._();
       if(type == TaskType.REDUCE) {
-        row.td().
-          br().$title(String.valueOf(shuffleFinishTime))._().
-          _(Times.format(shuffleFinishTime))._();
-        row.td().
-        br().$title(String.valueOf(sortFinishTime))._().
-        _(Times.format(sortFinishTime))._();
+        tasksTableData.append(shuffleFinishTime).append("\",\"")
+        .append(sortFinishTime).append("\",\"");
       }
-      row.
-          td().
-            br().$title(String.valueOf(attemptFinishTime))._().
-            _(Times.format(attemptFinishTime))._();
-
+      tasksTableData.append(attemptFinishTime).append("\",\"");
       if(type == TaskType.REDUCE) {
-        row.td().
-          br().$title(String.valueOf(elapsedShuffleTime))._().
-        _(formatTime(elapsedShuffleTime))._();
-        row.td().
-        br().$title(String.valueOf(elapsedSortTime))._().
-      _(formatTime(elapsedSortTime))._();
-        row.td().
-          br().$title(String.valueOf(elapsedReduceTime))._().
-        _(formatTime(elapsedReduceTime))._();
+        tasksTableData.append(elapsedShuffleTime).append("\",\"")
+        .append(elapsedSortTime).append("\",\"")
+        .append(elapsedReduceTime).append("\",\"");
       }
-
-      row.td().
-        br().$title(String.valueOf(attemptElapsed))._().
-        _(formatTime(attemptElapsed))._();
-      row._();
+      tasksTableData.append(attemptElapsed).append("\"],\n");
+    }
+    //Remove the last comma and close off the array of arrays
+    if(tasksTableData.charAt(tasksTableData.length() - 2) == ',') {
+      tasksTableData.delete(
+        tasksTableData.length()-2, tasksTableData.length()-1);
     }
+    tasksTableData.append("]");
+    html.script().$type("text/javascript").
+    _("var tasksTableData=" + tasksTableData)._();
+    
     TR<TFOOT<TABLE<Hamlet>>> footRow = tbody._().tfoot().tr();
     footRow.th().input("search_init").$type(InputType.text).$name("task")
         .$value("ID")._()._().th().input("search_init").$type(InputType.text)

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTasksPage.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTasksPage.java?rev=1409580&r1=1409579&r2=1409580&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTasksPage.java
(original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTasksPage.java
Thu Nov 15 00:01:07 2012
@@ -67,18 +67,32 @@ public class HsTasksPage extends HsView 
       type = MRApps.taskType(symbol);
     }
     StringBuilder b = tableInit().
-    append(",aoColumnDefs:[");
-    b.append("{'sType':'title-numeric', 'aTargets': [ 0, 4");
+    append(", 'aaData': tasksTableData");
+    b.append(", bDeferRender: true");
+    b.append(", bProcessing: true");
+
+    b.append("\n, aoColumnDefs: [\n");
+    b.append("{'sType':'numeric', 'aTargets': [ 0 ]");
+    b.append(", 'mRender': parseHadoopID }");
+
+    b.append(", {'sType':'numeric', 'aTargets': [ 4");
     if(type == TaskType.REDUCE) {
       b.append(", 9, 10, 11, 12");
     } else { //MAP
       b.append(", 7");
     }
-    b.append(" ] }]");
+    b.append(" ], 'mRender': renderHadoopElapsedTime }");
 
-    // Sort by id upon page load
-    b.append(", aaSorting: [[0, 'asc']]");
+    b.append("\n, {'sType':'numeric', 'aTargets': [ 2, 3, 5");
+    if(type == TaskType.REDUCE) {
+      b.append(", 6, 7, 8");
+    } else { //MAP
+      b.append(", 6");
+    }
+    b.append(" ], 'mRender': renderHadoopDate }]");
 
+    // Sort by id upon page load
+    b.append("\n, aaSorting: [[0, 'asc']]");
     b.append("}");
     return b.toString();
   }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java?rev=1409580&r1=1409579&r2=1409580&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java
(original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsView.java
Thu Nov 15 00:01:07 2012
@@ -82,17 +82,15 @@ public class HsView extends TwoColumnLay
    */
   private String jobsTableInit() {
     return tableInit().
+        append(", 'aaData': jobsTableData").
+        append(", bDeferRender: true").
+        append(", bProcessing: true").
+
         // Sort by id upon page load
         append(", aaSorting: [[2, 'desc']]").
         append(", aoColumnDefs:[").
-        // Maps Total
-        append("{'sType':'numeric', 'bSearchable': false, 'aTargets': [ 7 ] }").
-        // Maps Completed
-        append(",{'sType':'numeric', 'bSearchable': false, 'aTargets': [ 8 ] }").
-        // Reduces Total
-        append(",{'sType':'numeric', 'bSearchable': false, 'aTargets': [ 9 ] }").
-        // Reduces Completed
-        append(",{'sType':'numeric', 'bSearchable': false, 'aTargets': [ 10 ] }").
+        // Maps Total, Maps Completed, Reduces Total and Reduces Completed
+        append("{'sType':'numeric', 'bSearchable': false, 'aTargets': [ 7, 8, 9, 10 ] }").
         append("]}").
         toString();
   }



Mime
View raw message