hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1483940 - in /hadoop/common/trunk/hadoop-mapreduce-project: ./ hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/ hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoo...
Date Fri, 17 May 2013 18:16:33 GMT
Author: vinodkv
Date: Fri May 17 18:16:33 2013
New Revision: 1483940

URL: http://svn.apache.org/r1483940
Log:
MAPREDUCE-5234. Change mapred.TaskReport and mapreduce.TaskReport for binary compatibility
with mapred in 1.x but incompatible with 0.23.x. Contributed by Mayank Bansal.

Modified:
    hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt
    hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskReport.java
    hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskReport.java
    hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobInfo.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=1483940&r1=1483939&r2=1483940&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt Fri May 17 18:16:33 2013
@@ -172,6 +172,10 @@ Release 2.0.5-beta - UNRELEASED
     MAPREDUCE-4067. Changed MRClientProtocol api to throw IOException only (Xuan
     Gong via vinodkv)
 
+    MAPREDUCE-5234. Change mapred.TaskReport and mapreduce.TaskReport for binary
+    compatibility with mapred in 1.x but incompatible with 0.23.x. (Mayank Bansal
+    via vinodkv)
+
   NEW FEATURES
 
   IMPROVEMENTS

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskReport.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskReport.java?rev=1483940&r1=1483939&r2=1483940&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskReport.java
(original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskReport.java
Fri May 17 18:16:33 2013
@@ -75,7 +75,7 @@ public class TaskReport extends org.apac
   
   static TaskReport downgrade(
       org.apache.hadoop.mapreduce.TaskReport report) {
-    return new TaskReport(TaskID.downgrade(report.getTaskId()),
+    return new TaskReport(TaskID.downgrade(report.getTaskID()),
       report.getProgress(), report.getState(), report.getDiagnostics(),
       report.getCurrentStatus(), report.getStartTime(), report.getFinishTime(),
       Counters.downgrade(report.getTaskCounters()));
@@ -90,9 +90,16 @@ public class TaskReport extends org.apac
     return ret.toArray(new TaskReport[0]);
   }
   
+  /** The string of the task id. */
+  public String getTaskId() {
+    return TaskID.downgrade(super.getTaskID()).toString();
+  }
+
   /** The id of the task. */
-  public TaskID getTaskID() { return TaskID.downgrade(super.getTaskId()); }
-  
+  public TaskID getTaskID() {
+    return TaskID.downgrade(super.getTaskID());
+  }
+
   public Counters getCounters() { 
     return Counters.downgrade(super.getTaskCounters()); 
   }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskReport.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskReport.java?rev=1483940&r1=1483939&r2=1483940&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskReport.java
(original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/TaskReport.java
Fri May 17 18:16:33 2013
@@ -30,6 +30,7 @@ import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableUtils;
 import org.apache.hadoop.mapred.TIPStatus;
+import org.apache.hadoop.mapred.TaskID;
 import org.apache.hadoop.util.StringInterner;
 
 /** A report on the state of a task. */
@@ -76,9 +77,16 @@ public class TaskReport implements Writa
     this.finishTime = finishTime;
     this.counters = counters;
   }
-    
-  /** The id of the task. */
-  public TaskID getTaskId() { return taskid; }
+
+  /** The string of the task ID. */
+  public String getTaskId() {
+    return taskid.toString();
+  }
+
+  /** The ID of the task. */
+  public TaskID getTaskID() {
+    return taskid;
+  }
 
   /** The amount completed, between zero and one. */
   public float getProgress() { return progress; }
@@ -171,7 +179,7 @@ public class TaskReport implements Writa
              && this.progress == report.getProgress()
              && this.startTime == report.getStartTime()
              && this.state.equals(report.getState())
-             && this.taskid.equals(report.getTaskId());
+             && this.taskid.equals(report.getTaskID());
     }
     return false; 
   }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobInfo.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobInfo.java?rev=1483940&r1=1483939&r2=1483940&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobInfo.java
(original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestJobInfo.java
Fri May 17 18:16:33 2013
@@ -26,6 +26,11 @@ import java.io.IOException;
 
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
+import org.apache.hadoop.mapreduce.JobID;
+import org.apache.hadoop.mapreduce.TaskID;
+import org.apache.hadoop.mapreduce.TaskType;
+import org.apache.hadoop.mapreduce.JobStatus.State;
+import org.junit.Assert;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
@@ -53,4 +58,20 @@ public class TestJobInfo {
     assertEquals(info.getUser().toString(), copyinfo.getUser().toString());
 
   }
+  
+  @Test(timeout = 5000)
+  public void testTaskID() throws IOException, InterruptedException {
+    JobID jobid = new JobID("1014873536921", 6);
+    TaskID tid = new TaskID(jobid, TaskType.MAP, 0);
+    org.apache.hadoop.mapred.TaskID tid1 =
+        org.apache.hadoop.mapred.TaskID.downgrade(tid);
+    org.apache.hadoop.mapred.TaskReport treport =
+        new org.apache.hadoop.mapred.TaskReport(tid1, 0.0f,
+          State.FAILED.toString(), null, TIPStatus.FAILED, 100, 100,
+          new org.apache.hadoop.mapred.Counters());
+    Assert
+      .assertEquals(treport.getTaskId(), "task_1014873536921_0006_m_000000");
+    Assert.assertEquals(treport.getTaskID().toString(),
+      "task_1014873536921_0006_m_000000");
+  }
 }



Mime
View raw message