Переглянути джерело

HADOOP-1839. Link-ify the Pending/Running/Complete/Killed grid in jobdetails.jsp to help quickly narrow down and see categorized TIPs' details via jobtasks.jsp. (Amar Kamat via acmurthy)

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@588168 13f79535-47bb-0310-9956-ffa450edef68
Arun Murthy 17 роки тому
батько
коміт
9e2b1338b0
3 змінених файлів з 53 додано та 10 видалено
  1. 4 0
      CHANGES.txt
  2. 20 7
      src/webapps/job/jobdetails.jsp
  3. 29 3
      src/webapps/job/jobtasks.jsp

+ 4 - 0
CHANGES.txt

@@ -24,6 +24,10 @@ Trunk (unreleased changes)
     HADOOP-1604.  An system administrator can finalize namenode upgrades 
     HADOOP-1604.  An system administrator can finalize namenode upgrades 
     without running the cluster. (Konstantin Shvachko via dhruba)
     without running the cluster. (Konstantin Shvachko via dhruba)
 
 
+    HADOOP-1839.  Link-ify the Pending/Running/Complete/Killed grid in
+    jobdetails.jsp to help quickly narrow down and see categorized TIPs' 
+    details via jobtasks.jsp. (Amar Kamat via acmurthy)
+
   OPTIMIZATIONS
   OPTIMIZATIONS
 
 
     HADOOP-1898.  Release the lock protecting the last time of the last stack
     HADOOP-1898.  Release the lock protecting the last time of the last stack

+ 20 - 7
src/webapps/job/jobdetails.jsp

@@ -44,6 +44,7 @@
       failedTaskAttempts += task.numTaskFailures();
       failedTaskAttempts += task.numTaskFailures();
       killedTaskAttempts += task.numKilledTasks();
       killedTaskAttempts += task.numKilledTasks();
     }
     }
+    int pendingTasks = totalTasks - runningTasks - killedTasks - finishedTasks; 
     out.print("<tr><th><a href=\"jobtasks.jsp?jobid=" + jobId + 
     out.print("<tr><th><a href=\"jobtasks.jsp?jobid=" + jobId + 
               "&type="+ kind + "&pagenum=1\">" + kind + 
               "&type="+ kind + "&pagenum=1\">" + kind + 
               "</a></th><td align=\"right\">" + 
               "</a></th><td align=\"right\">" + 
@@ -52,13 +53,25 @@
               "</td><td align=\"right\">" + 
               "</td><td align=\"right\">" + 
               totalTasks + 
               totalTasks + 
               "</td><td align=\"right\">" + 
               "</td><td align=\"right\">" + 
-              (totalTasks - runningTasks - finishedTasks - killedTasks) + 
-              "</td><td align=\"right\">" +
-              runningTasks + 
-              "</td><td align=\"right\">" +
-              finishedTasks + 
-              "</td><td align=\"right\">" +
-              killedTasks +
+              ((pendingTasks > 0) 
+               ? "<a href=\"jobtasks.jsp?jobid=" + jobId + "&type="+ kind + 
+                 "&pagenum=1" + "&state=pending\">" + pendingTasks + "</a>"
+               : "0") + 
+              "</td><td align=\"right\">" + 
+              ((runningTasks > 0) 
+               ? "<a href=\"jobtasks.jsp?jobid=" + jobId + "&type="+ kind + 
+                 "&pagenum=1" + "&state=running\">" + runningTasks + "</a>" 
+               : "0") + 
+              "</td><td align=\"right\">" + 
+              ((finishedTasks > 0) 
+               ?"<a href=\"jobtasks.jsp?jobid=" + jobId + "&type="+ kind + 
+                "&pagenum=1" + "&state=completed\">" + finishedTasks + "</a>" 
+               : "0") + 
+              "</td><td align=\"right\">" + 
+              ((killedTasks > 0) 
+               ?"<a href=\"jobtasks.jsp?jobid=" + jobId + "&type="+ kind +
+                "&pagenum=1" + "&state=killed\">" + killedTasks + "</a>"
+               : "0") + 
               "</td><td align=\"right\">" + 
               "</td><td align=\"right\">" + 
               ((failedTaskAttempts > 0) ? 
               ((failedTaskAttempts > 0) ? 
                   ("<a href=\"jobfailures.jsp?jobid=" + jobId + 
                   ("<a href=\"jobfailures.jsp?jobid=" + jobId + 

+ 29 - 3
src/webapps/job/jobtasks.jsp

@@ -17,6 +17,9 @@
   String jobid = request.getParameter("jobid");
   String jobid = request.getParameter("jobid");
   String type = request.getParameter("type");
   String type = request.getParameter("type");
   String pagenum = request.getParameter("pagenum");
   String pagenum = request.getParameter("pagenum");
+  TaskInProgress[] tasks;
+  String state = request.getParameter("state");
+  state = (state!=null) ? state : "all";
   int pnum = Integer.parseInt(pagenum);
   int pnum = Integer.parseInt(pagenum);
   int next_page = pnum+1;
   int next_page = pnum+1;
   int numperpage = 2000;
   int numperpage = 2000;
@@ -29,9 +32,11 @@
   int report_len = 0;
   int report_len = 0;
   if ("map".equals(type)){
   if ("map".equals(type)){
      reports = (job != null) ? tracker.getMapTaskReports(jobid) : null;
      reports = (job != null) ? tracker.getMapTaskReports(jobid) : null;
+     tasks = (job != null) ? job.getMapTasks() : null;
     }
     }
   else{
   else{
     reports = (job != null) ? tracker.getReduceTaskReports(jobid) : null;
     reports = (job != null) ? tracker.getReduceTaskReports(jobid) : null;
+    tasks = (job != null) ? job.getReduceTasks() : null;
   }
   }
 %>
 %>
 
 
@@ -50,13 +55,34 @@
     out.print("<b>Job " + jobid + " not found.</b><br>\n");
     out.print("<b>Job " + jobid + " not found.</b><br>\n");
     return;
     return;
   }
   }
+  // Filtering the reports if some filter is specified
+  if (!"all".equals(state)) {
+    List<TaskReport> filteredReports = new ArrayList<TaskReport>();
+    for (int i = 0; i < reports.length; ++i) {
+      if ("completed".equals(state) && tasks[i].isComplete()) {
+        filteredReports.add(reports[i]);
+      } else if ("running".equals(state) && tasks[i].isRunning()) {
+        filteredReports.add(reports[i]);
+      } else if ("killed".equals(state) && tasks[i].wasKilled()) {
+        filteredReports.add(reports[i]);
+      } else if ("pending".equals(state) 
+                 && !(tasks[i].isComplete() || tasks[i].isRunning() 
+                      || tasks[i].wasKilled())) {
+        filteredReports.add(reports[i]);
+      }
+    }
+    tasks = null; // free the task memory
+    // using filtered reports instead of all the reports
+    reports = filteredReports.toArray(new TaskReport[0]);
+  }
   report_len = reports.length;
   report_len = reports.length;
   
   
   if (report_len <= start_index) {
   if (report_len <= start_index) {
     out.print("<b>No such tasks</b>");
     out.print("<b>No such tasks</b>");
   } else {
   } else {
     out.print("<hr>");
     out.print("<hr>");
-    out.print("<h2>Tasks</h2>");
+    out.print("<h2>" + Character.toUpperCase(state.charAt(0)) 
+              + state.substring(1).toLowerCase() + " Tasks</h2>");
     out.print("<center>");
     out.print("<center>");
     out.print("<table border=2 cellpadding=\"5\" cellspacing=\"2\">");
     out.print("<table border=2 cellpadding=\"5\" cellspacing=\"2\">");
     out.print("<tr><td align=\"center\">Task</td><td>Complete</td><td>Status</td>" +
     out.print("<tr><td align=\"center\">Task</td><td>Complete</td><td>Status</td>" +
@@ -93,13 +119,13 @@
   if (end_index < report_len) {
   if (end_index < report_len) {
     out.print("<div style=\"text-align:right\">" + 
     out.print("<div style=\"text-align:right\">" + 
               "<a href=\"jobtasks.jsp?jobid="+ jobid + "&type=" + type +
               "<a href=\"jobtasks.jsp?jobid="+ jobid + "&type=" + type +
-              "&pagenum=" + next_page +
+              "&pagenum=" + next_page + "&state=" + state +
               "\">" + "Next" + "</a></div>");
               "\">" + "Next" + "</a></div>");
   }
   }
   if (start_index != 0) {
   if (start_index != 0) {
       out.print("<div style=\"text-align:right\">" + 
       out.print("<div style=\"text-align:right\">" + 
                 "<a href=\"jobtasks.jsp?jobid="+ jobid + "&type=" + type +
                 "<a href=\"jobtasks.jsp?jobid="+ jobid + "&type=" + type +
-                "&pagenum=" + (pnum -1) + "\">" + "Prev" + "</a></div>");
+                "&pagenum=" + (pnum -1) + "&state=" + state + "\">" + "Prev" + "</a></div>");
   }
   }
 %>
 %>