Sfoglia il codice sorgente

HADOOP-293. Report the full list of task error messages in the web ui, not just the most recent. Contributed by Owen.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@448339 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 19 anni fa
parent
commit
a2cf1f6922

+ 3 - 0
CHANGES.txt

@@ -36,6 +36,9 @@ Trunk (unreleased changes)
 10. HADOOP-261.  Record an error message when map output is lost.
     (omalley via cutting)
 
+11. HADOOP-293.  Report the full list of task error messages in the
+    web ui, not just the most recent.  (omalley via cutting)
+
 
 Release 0.6.2 (unreleased)
 

+ 22 - 1
src/java/org/apache/hadoop/mapred/JobTracker.java

@@ -403,7 +403,7 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
     Vector jobsByArrival = new Vector();
 
     // All the known TaskInProgress items, mapped to by taskids (taskid->TIP)
-    TreeMap taskidToTIPMap = new TreeMap();
+    Map<String, TaskInProgress> taskidToTIPMap = new TreeMap();
 
     // (taskid --> trackerID) 
     TreeMap taskidToTrackerMap = new TreeMap();
@@ -1081,6 +1081,27 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
         }
     }
 
+    /**
+     * Get the diagnostics for a given task
+     * @param jobId the id of the job
+     * @param tipId the id of the tip 
+     * @param taskId the id of the task
+     * @return a list of the diagnostic messages
+     */
+    public synchronized List<String> getTaskDiagnostics(String jobId,
+                                                        String tipId,
+                                                        String taskId) {
+      JobInProgress job = (JobInProgress) jobs.get(jobId);
+      if (job == null) {
+        throw new IllegalArgumentException("Job " + jobId + " not found.");
+      }
+      TaskInProgress tip = job.getTaskInProgress(tipId);
+      if (tip == null) {
+        throw new IllegalArgumentException("TIP " + tipId + " not found.");
+      }
+      return tip.getDiagnosticInfo(taskId);
+    }
+    
     /** Get all the TaskStatuses from the tipid. */
     TaskStatus[] getTaskStatuses(String jobid, String tipid){
 	JobInProgress job = (JobInProgress) jobs.get(jobid);

+ 10 - 1
src/java/org/apache/hadoop/mapred/TaskInProgress.java

@@ -71,7 +71,7 @@ class TaskInProgress {
     private TreeSet recentTasks = new TreeSet();
     private JobConf conf;
     private boolean runSpeculative;
-    private TreeMap taskDiagnosticData = new TreeMap();
+    private Map<String,List<String>> taskDiagnosticData = new TreeMap();
     /**
      * Map from taskId -> TaskStatus
      */
@@ -242,6 +242,15 @@ class TaskInProgress {
          (String[])diagnostics.toArray(new String[diagnostics.size()]));
     }
 
+    /**
+     * Get the diagnostic messages for a given task within this tip.
+     * @param taskId the id of the required task
+     * @return the list of diagnostics for that task
+     */
+    synchronized List<String> getDiagnosticInfo(String taskId) {
+      return taskDiagnosticData.get(taskId);
+    }
+    
     ////////////////////////////////////////////////
     // Update methods, usually invoked by the owning
     // job.

+ 16 - 2
src/webapps/job/jobfailures.jsp

@@ -33,8 +33,22 @@
                     taskTracker.getHttpPort() + "\">" +  taskTracker.getHost() + 
                     "</a></td>");
         }
-        out.print("<td>" + statuses[i].getDiagnosticInfo() + "</td></tr>\n");
-      }
+        out.print("<td><pre>");
+        List<String> failures = 
+                     tracker.getTaskDiagnostics(jobId, tipId, 
+                                                statuses[i].getTaskId());
+        if (failures == null) {
+          out.print("&nbsp;");
+        } else {
+          for(Iterator<String> itr = failures.iterator(); itr.hasNext(); ) {
+            out.print(itr.next());
+            if (itr.hasNext()) {
+              out.print("\n-------\n");
+            }
+           }
+         }
+         out.print("</pre></td></tr>\n");
+       }
     }
   }
              

+ 16 - 3
src/webapps/job/taskdetails.jsp

@@ -12,8 +12,8 @@
   String jobid = request.getParameter("jobid");
   JobTracker tracker = JobTracker.getTracker();
   JobInProgress job = (JobInProgress) tracker.getJob(jobid);
-  String taskid = request.getParameter("taskid");
-  TaskStatus[] ts = (job != null) ? tracker.getTaskStatuses(jobid, taskid): null;
+  String tipid = request.getParameter("taskid");
+  TaskStatus[] ts = (job != null) ? tracker.getTaskStatuses(jobid, tipid): null;
 %>
 
 <%! 
@@ -68,7 +68,20 @@
       out.print("</td>");
       out.print("<td>"+ StringUtils.formatPercent(status.getProgress()) + 
                 "</td>");
-      out.print("<td><pre>" + status.getDiagnosticInfo() + "</pre></td>");
+      out.print("<td><pre>");
+      List<String> failures = tracker.getTaskDiagnostics(jobid, tipid,
+                                                         status.getTaskId());
+      if (failures == null) {
+        out.print("&nbsp;");
+      } else {
+        for(Iterator<String> itr = failures.iterator(); itr.hasNext(); ) {
+          out.print(itr.next());
+          if (itr.hasNext()) {
+            out.print("\n-------\n");
+          }
+        }
+      }
+      out.print("</pre></td>");
       out.print("</tr>\n");
     }
   %>