hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yhema...@apache.org
Subject svn commit: r746274 - in /hadoop/core/trunk: CHANGES.txt src/mapred/org/apache/hadoop/mapred/JobInProgress.java
Date Fri, 20 Feb 2009 15:19:32 GMT
Author: yhemanth
Date: Fri Feb 20 15:19:31 2009
New Revision: 746274

URL: http://svn.apache.org/viewvc?rev=746274&view=rev
Log:
HADOOP-5282. Fixed job history logs for task attempts that are failed by the JobTracker, say
due to lost task trackers. Contributed by Amar Kamat.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobInProgress.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=746274&r1=746273&r2=746274&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Fri Feb 20 15:19:31 2009
@@ -818,6 +818,9 @@
     job is not in memory and a tasktracker comes to the jobtracker with a status
     report of a task belonging to that job. (Amar Kamat via ddas)
 
+    HADOOP-5282. Fixed job history logs for task attempts that are failed by the
+    JobTracker, say due to lost task trackers. (Amar Kamat via yhemanth)
+
 Release 0.19.1 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobInProgress.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobInProgress.java?rev=746274&r1=746273&r2=746274&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobInProgress.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobInProgress.java Fri Feb 20 15:19:31
2009
@@ -1992,10 +1992,7 @@
     TaskTrackerStatus ttStatus = 
       this.jobtracker.getTaskTracker(status.getTaskTracker());
     String trackerHostname = jobtracker.getNode(ttStatus.getHost()).toString();
-    String taskType = tip.isJobCleanupTask() ? Values.CLEANUP.name() :
-                      tip.isJobSetupTask() ? Values.SETUP.name() :
-                      tip.isMapTask() ? Values.MAP.name() : 
-                      Values.REDUCE.name();
+    String taskType = getTaskType(tip);
     if (status.getIsMap()){
       JobHistory.MapAttempt.logStarted(status.getTaskID(), status.getStartTime(), 
                                        status.getTaskTracker(), 
@@ -2306,10 +2303,7 @@
     List<String> taskDiagnosticInfo = tip.getDiagnosticInfo(taskid);
     String diagInfo = taskDiagnosticInfo == null ? "" :
       StringUtils.arrayToString(taskDiagnosticInfo.toArray(new String[0]));
-    String taskType = tip.isJobCleanupTask() ? Values.CLEANUP.name() :
-                      tip.isJobSetupTask() ? Values.SETUP.name() :
-                      tip.isMapTask() ? Values.MAP.name() : 
-                      Values.REDUCE.name();
+    String taskType = getTaskType(tip);
     if (taskStatus.getIsMap()) {
       JobHistory.MapAttempt.logStarted(taskid, startTime, 
         taskTrackerName, taskTrackerPort, taskType);
@@ -2432,12 +2426,14 @@
                                                     trackerName, phase,
                                                     new Counters());
     status.setFinishTime(System.currentTimeMillis());
+    boolean wasComplete = tip.isComplete();
     updateTaskStatus(tip, status, metrics);
-    JobHistory.Task.logFailed(tip.getTIPId(), 
-                              tip.isJobCleanupTask() ? Values.CLEANUP.name() : 
-                              tip.isJobSetupTask() ? Values.SETUP.name() : 
-                              tip.isMapTask() ? Values.MAP.name() : Values.REDUCE.name(),

-                              tip.getExecFinishTime(), reason, taskid); 
+    boolean isComplete = tip.isComplete();
+    if (wasComplete && !isComplete) { // mark a successful tip as failed
+      String taskType = getTaskType(tip);
+      JobHistory.Task.logFailed(tip.getTIPId(), taskType, 
+                                tip.getExecFinishTime(), reason, taskid);
+    }
   }
        
                            
@@ -2611,4 +2607,19 @@
   boolean isComplete() {
     return status.isJobComplete();
   }
+  
+  /**
+   * Get the task type for logging it to {@link JobHistory}.
+   */
+  private String getTaskType(TaskInProgress tip) {
+    if (tip.isJobCleanupTask()) {
+      return Values.CLEANUP.name();
+    } else if (tip.isJobSetupTask()) {
+      return Values.SETUP.name();
+    } else if (tip.isMapTask()) {
+      return Values.MAP.name();
+    } else {
+      return Values.REDUCE.name();
+    }
+  }
 }



Mime
View raw message