tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hit...@apache.org
Subject svn commit: r1470761 - in /incubator/tez/branches/TEZ-1/tez-mapreduce/src: main/java/org/apache/tez/mapreduce/hadoop/ test/java/org/apache/tez/mapreduce/ test/java/org/apache/tez/mapreduce/processor/ test/java/org/apache/tez/mapreduce/processor/reduce/
Date Tue, 23 Apr 2013 00:18:41 GMT
Author: hitesh
Date: Tue Apr 23 00:18:41 2013
New Revision: 1470761

URL: http://svn.apache.org/r1470761
Log:
TEZ-33. Remove MRTaskType. (hitesh)

Removed:
    incubator/tez/branches/TEZ-1/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/MRTaskType.java
Modified:
    incubator/tez/branches/TEZ-1/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/IDConverter.java
    incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/TestTaskModules.java
    incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/TezTestUtils.java
    incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/processor/MapUtils.java
    incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/processor/reduce/TestReduceProcessor.java

Modified: incubator/tez/branches/TEZ-1/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/IDConverter.java
URL: http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/IDConverter.java?rev=1470761&r1=1470760&r2=1470761&view=diff
==============================================================================
--- incubator/tez/branches/TEZ-1/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/IDConverter.java
(original)
+++ incubator/tez/branches/TEZ-1/tez-mapreduce/src/main/java/org/apache/tez/mapreduce/hadoop/IDConverter.java
Tue Apr 23 00:18:41 2013
@@ -59,23 +59,6 @@ public class IDConverter {
         Long.valueOf(jobId.getJtIdentifier()), jobId.getId()), 1);
   }
 
-  public static MRTaskType fromMRTaskType(TaskType type) {
-    switch (type) {
-      case REDUCE:
-        return MRTaskType.REDUCE;
-      case JOB_SETUP:
-        return MRTaskType.JOB_SETUP;
-      case JOB_CLEANUP:
-        return MRTaskType.JOB_CLEANUP;
-      case TASK_CLEANUP:
-        return MRTaskType.TASK_CLEANUP;
-      case MAP:
-        return MRTaskType.MAP;
-      default:
-        throw new RuntimeException("Unknown TaskType: " + type);
-    }
-  }
-
   // FIXME hack alert converting objects with hard coded id
   public static TezTaskID
       fromMRTaskId(org.apache.hadoop.mapreduce.TaskID taskid) {

Modified: incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/TestTaskModules.java
URL: http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/TestTaskModules.java?rev=1470761&r1=1470760&r2=1470761&view=diff
==============================================================================
--- incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/TestTaskModules.java
(original)
+++ incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/TestTaskModules.java
Tue Apr 23 00:18:41 2013
@@ -37,7 +37,6 @@ import org.apache.tez.engine.runtime.Pro
 import org.apache.tez.engine.runtime.TaskFactory;
 import org.apache.tez.engine.runtime.TezEngineFactory;
 import org.apache.tez.engine.runtime.TezEngineFactoryImpl;
-import org.apache.tez.mapreduce.hadoop.MRTaskType;
 import org.apache.tez.mapreduce.input.SimpleInput;
 import org.apache.tez.mapreduce.output.SimpleOutput;
 import org.apache.tez.mapreduce.processor.map.MapProcessor;
@@ -64,8 +63,9 @@ public class TestTaskModules {
   
   @Before
   public void setUp() {
-    taskContext = new TezEngineTaskContext(TezTestUtils.getMockTaskAttemptId(0, 0, 0,
-        MRTaskType.REDUCE), "tez", "tez", "TODO_vertexName",
+    taskContext = new TezEngineTaskContext(
+        TezTestUtils.getMockTaskAttemptId(0, 0, 0, 0),
+        "tez", "tez", "TODO_vertexName",
         TestInitialModule.class.getName(), null, null);
     job = new JobConf();
   }

Modified: incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/TezTestUtils.java
URL: http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/TezTestUtils.java?rev=1470761&r1=1470760&r2=1470761&view=diff
==============================================================================
--- incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/TezTestUtils.java
(original)
+++ incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/TezTestUtils.java
Tue Apr 23 00:18:41 2013
@@ -17,55 +17,44 @@
  */
 package org.apache.tez.mapreduce;
 
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.util.Records;
+import org.apache.hadoop.yarn.util.BuilderUtils;
 import org.apache.tez.engine.records.TezDAGID;
 import org.apache.tez.engine.records.TezTaskAttemptID;
 import org.apache.tez.engine.records.TezTaskID;
 import org.apache.tez.engine.records.TezVertexID;
-import org.apache.tez.mapreduce.hadoop.MRTaskType;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 public class TezTestUtils {
 
   public static TezTaskAttemptID getMockTaskAttemptId(
-      int jobId, int taskId, int taskAttemptId, MRTaskType type) {
-    TezTaskAttemptID taskAttemptID = mock(TezTaskAttemptID.class);
-    TezTaskID taskID = getMockTaskId(jobId, taskId, type);
-    when(taskAttemptID.getTaskID()).thenReturn(taskID);
-    when(taskAttemptID.getId()).thenReturn(taskAttemptId);
-    when(taskAttemptID.toString()).thenReturn(
-        "attempt_tez_" + Integer.toString(jobId) + "_" + 
-        ((type == MRTaskType.MAP) ? "m" : "r") + "_" + 
-        Integer.toString(taskId) + "_" + Integer.toString(taskAttemptId)
-        );
-    return taskAttemptID;
+      int jobId, int vertexId, int taskId, int taskAttemptId) {
+    return new TezTaskAttemptID(
+        new TezTaskID(
+            new TezVertexID(
+                new TezDAGID(
+                    BuilderUtils.newApplicationId(0, jobId), jobId),
+                    vertexId),
+                    taskId)
+        , taskAttemptId);
   }
   
-  public static TezTaskID getMockTaskId(int jobId, int taskId, MRTaskType type) {
-    TezVertexID vertexID = getMockVertexId(jobId, type);
-    TezTaskID taskID = mock(TezTaskID.class);
-    when(taskID.getVertexID()).thenReturn(vertexID);
-    when(taskID.getId()).thenReturn(taskId);
-    return taskID;
+  public static TezTaskID getMockTaskId(int jobId,
+      int vertexId, int taskId) {
+    return new TezTaskID(
+        new TezVertexID(new TezDAGID(
+            BuilderUtils.newApplicationId(0, jobId),
+            jobId), vertexId),
+            taskId);
   }
   
   public static TezDAGID getMockJobId(int jobId) {
-    TezDAGID jobID = mock(TezDAGID.class);
-    ApplicationId appId = Records.newRecord(ApplicationId.class);
-    appId.setClusterTimestamp(0L);
-    appId.setId(jobId);
-    when(jobID.getId()).thenReturn(jobId);
-    when(jobID.getApplicationId()).thenReturn(appId);
-    return jobID;
+    return new TezDAGID(
+        BuilderUtils.newApplicationId(0, jobId), jobId);
   }
   
-  public static TezVertexID getMockVertexId(int jobId, MRTaskType type) {
-    TezVertexID vertexID = mock(TezVertexID.class);
-    when(vertexID.getDAGId()).thenReturn(getMockJobId(jobId));
-    when(vertexID.getId()).thenReturn(type == MRTaskType.MAP ? 0 : 1);
-    return vertexID;
+  public static TezVertexID getMockVertexId(int jobId, int vId) {
+    return new TezVertexID(
+        new TezDAGID(
+            BuilderUtils.newApplicationId(0, jobId), jobId),
+            vId);
   }
 }

Modified: incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/processor/MapUtils.java
URL: http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/processor/MapUtils.java?rev=1470761&r1=1470760&r2=1470761&view=diff
==============================================================================
--- incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/processor/MapUtils.java
(original)
+++ incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/processor/MapUtils.java
Tue Apr 23 00:18:41 2013
@@ -42,7 +42,6 @@ import org.apache.tez.common.TezEngineTa
 import org.apache.tez.engine.api.Task;
 import org.apache.tez.engine.runtime.TezEngineFactory;
 import org.apache.tez.mapreduce.TezTestUtils;
-import org.apache.tez.mapreduce.hadoop.MRTaskType;
 import org.apache.tez.mapreduce.hadoop.TezTaskUmbilicalProtocol;
 import org.apache.tez.mapreduce.input.SimpleInput;
 import org.apache.tez.mapreduce.task.InitialTaskWithLocalSort;
@@ -99,7 +98,7 @@ public class MapUtils {
     InputSplit split = createInputSplit(fs, workDir, jobConf, mapInput);
     TezEngineTaskContext taskContext = 
         new TezEngineTaskContext(
-        TezTestUtils.getMockTaskAttemptId(0, mapId, 0, MRTaskType.MAP), "tez",
+        TezTestUtils.getMockTaskAttemptId(0, 0, mapId, 0), "tez",
         "tez", "TODO_vertexName", InitialTaskWithLocalSort.class.getName(),
         null, null);
   

Modified: incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/processor/reduce/TestReduceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/processor/reduce/TestReduceProcessor.java?rev=1470761&r1=1470760&r2=1470761&view=diff
==============================================================================
--- incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/processor/reduce/TestReduceProcessor.java
(original)
+++ incubator/tez/branches/TEZ-1/tez-mapreduce/src/test/java/org/apache/tez/mapreduce/processor/reduce/TestReduceProcessor.java
Tue Apr 23 00:18:41 2013
@@ -37,7 +37,6 @@ import org.apache.tez.engine.common.task
 import org.apache.tez.engine.runtime.TezEngineFactory;
 import org.apache.tez.mapreduce.TestUmbilicalProtocol;
 import org.apache.tez.mapreduce.TezTestUtils;
-import org.apache.tez.mapreduce.hadoop.MRTaskType;
 import org.apache.tez.mapreduce.processor.MapUtils;
 import org.apache.tez.mapreduce.task.InitialTaskWithLocalSort;
 import org.apache.tez.mapreduce.task.LocalFinalTask;
@@ -95,7 +94,7 @@ public class TestReduceProcessor {
     
     // Now run a reduce
     TezEngineTaskContext taskContext = new TezEngineTaskContext(
-        TezTestUtils.getMockTaskAttemptId(0, 0, 0, MRTaskType.REDUCE), "tez",
+        TezTestUtils.getMockTaskAttemptId(0, 0, 0, 0), "tez",
         "tez", "TODO_vertexName", LocalFinalTask.class.getName(),
         Collections.singletonList(new InputSpec("TODO_srcVertexName", 1)), null);
     job.set(JobContext.TASK_ATTEMPT_ID, taskContext.getTaskAttemptId().toString());



Mime
View raw message