You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cu...@apache.org on 2007/09/13 23:05:33 UTC

svn commit: r575450 - in /lucene/hadoop/trunk: ./ src/java/org/apache/hadoop/mapred/ src/webapps/job/

Author: cutting
Date: Thu Sep 13 14:05:32 2007
New Revision: 575450

URL: http://svn.apache.org/viewvc?rev=575450&view=rev
Log:
HADOOP-1592.  Log error messages to the client console when tasks fail.  Contributed by Amar Kamat.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobSubmissionProtocol.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/LocalJobRunner.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java
    lucene/hadoop/trunk/src/webapps/job/jobfailures.jsp
    lucene/hadoop/trunk/src/webapps/job/taskdetails.jsp

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=575450&r1=575449&r2=575450&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Thu Sep 13 14:05:32 2007
@@ -223,6 +223,9 @@
     second jobtracker doesn't trash one that's already running.
     (omalley via cutting)
 
+    HADOOP-1592.  Log error messages to the client console when tasks
+    fail.  (Amar Kamat via cutting)
+
 
 Release 0.14.1 - 2007-09-04
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java?rev=575450&r1=575449&r2=575450&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobClient.java Thu Sep 13 14:05:32 2007
@@ -54,6 +54,7 @@
 import org.apache.hadoop.io.retry.RetryPolicy;
 import org.apache.hadoop.io.retry.RetryProxy;
 import org.apache.hadoop.ipc.RPC;
+import org.apache.hadoop.mapred.TaskInProgress;
 import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
@@ -641,6 +642,16 @@
                 if (event.getTaskStatus() == 
                     TaskCompletionEvent.Status.FAILED){
                   LOG.info(event.toString());
+                  // Displaying the task diagnostic information
+                  String taskId = event.getTaskId();
+                  String tipId = TaskInProgress.getTipId(taskId);
+                  String[] taskDiagnostics = 
+                	  jc.jobSubmitClient.getTaskDiagnostics(jobId, tipId, 
+                			                                taskId); 
+                  for(String diagnostics : taskDiagnostics){
+                   	System.err.println(diagnostics);
+                  }
+                  // Displaying the task logs
                   displayTaskLogs(event.getTaskId(), event.getTaskTrackerHttp());
                 }
                 break; 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobSubmissionProtocol.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobSubmissionProtocol.java?rev=575450&r1=575449&r2=575450&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobSubmissionProtocol.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobSubmissionProtocol.java Thu Sep 13 14:05:32 2007
@@ -121,4 +121,12 @@
   public TaskCompletionEvent[] getTaskCompletionEvents(
                                                        String jobid, int fromEventId, int maxEvents) throws IOException;
     
+  /**
+   * Get the diagnostics for a given task in a given job
+   * @param jobId the id of the job
+   * @return an array of the diagnostic messages
+   */
+  public String[] getTaskDiagnostics(String jobId, String tipId, String taskId) 
+  throws IOException;  
+  
 }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java?rev=575450&r1=575449&r2=575450&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java Thu Sep 13 14:05:32 2007
@@ -1651,11 +1651,11 @@
    * @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
+   * @return an array of the diagnostic messages
    */
-  public synchronized List<String> getTaskDiagnostics(String jobId,
+  public synchronized String[] getTaskDiagnostics(String jobId,
                                                       String tipId,
-                                                      String taskId) {
+                                                      String taskId) throws IOException {
     JobInProgress job = jobs.get(jobId);
     if (job == null) {
       throw new IllegalArgumentException("Job " + jobId + " not found.");
@@ -1664,7 +1664,7 @@
     if (tip == null) {
       throw new IllegalArgumentException("TIP " + tipId + " not found.");
     }
-    return tip.getDiagnosticInfo(taskId);
+    return tip.getDiagnosticInfo(taskId).toArray(new String[0]);
   }
     
   /** Get all the TaskStatuses from the tipid. */

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/LocalJobRunner.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/LocalJobRunner.java?rev=575450&r1=575449&r2=575450&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/LocalJobRunner.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/LocalJobRunner.java Thu Sep 13 14:05:32 2007
@@ -335,4 +335,12 @@
     idFormat.setGroupingUsed(false);
   }
   
+  /**
+   * Returns the diagnostic information for a particular task in the given job.
+   * To be implemented
+   */
+  public String[] getTaskDiagnostics(String jobid, String tipId, String taskid)
+  		throws IOException{
+	  return new String [0];
+  }
 }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java?rev=575450&r1=575449&r2=575450&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java Thu Sep 13 14:05:32 2007
@@ -785,4 +785,11 @@
   public int getSuccessEventNumber() {
     return successEventNumber;
   }
+  
+  /**
+   * Gets the tip id for the given taskid
+   * */
+  public static String getTipId(String taskId){
+	  return taskId.substring(0, taskId.lastIndexOf('_')).replace("task", "tip");
+  }
 }

Modified: lucene/hadoop/trunk/src/webapps/job/jobfailures.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/job/jobfailures.jsp?rev=575450&r1=575449&r2=575450&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/webapps/job/jobfailures.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/job/jobfailures.jsp Thu Sep 13 14:05:32 2007
@@ -40,15 +40,15 @@
         }
         out.print("<td>" + taskState + "</td>");
         out.print("<td><pre>");
-        List<String> failures = 
+        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()) {
+          for(int j = 0 ; j < failures.length ; j++){
+            out.print(failures[j]);
+            if (j < (failures.length - 1)) {
               out.print("\n-------\n");
             }
           }

Modified: lucene/hadoop/trunk/src/webapps/job/taskdetails.jsp
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/webapps/job/taskdetails.jsp?rev=575450&r1=575449&r2=575450&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/webapps/job/taskdetails.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/job/taskdetails.jsp Thu Sep 13 14:05:32 2007
@@ -123,15 +123,15 @@
           .getFinishTime(), status.getStartTime()) + "</td>");
 
         out.print("<td><pre>");
-        List<String> failures = tracker.getTaskDiagnostics(jobid, tipid,
+        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");
+          for(int j = 0 ; j < failures.length ; j++){
+            out.print(failures[j]);
+            if (j < (failures.length - 1)) {
+              out.print("\n-------\n");
             }
           }
         }