hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r1148209 - in /hadoop/common/branches/MR-279/mapreduce: ./ mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/
Date Tue, 19 Jul 2011 07:42:06 GMT
Author: sharad
Date: Tue Jul 19 07:42:05 2011
New Revision: 1148209

URL: http://svn.apache.org/viewvc?rev=1148209&view=rev
Log:
MAPREDUCE-2661. Fix TaskImpl to not access MapTaskImpl. Contributed by Ahmed Radwan.

Modified:
    hadoop/common/branches/MR-279/mapreduce/CHANGES.txt
    hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/MapTaskImpl.java
    hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskImpl.java

Modified: hadoop/common/branches/MR-279/mapreduce/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/CHANGES.txt?rev=1148209&r1=1148208&r2=1148209&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/CHANGES.txt (original)
+++ hadoop/common/branches/MR-279/mapreduce/CHANGES.txt Tue Jul 19 07:42:05 2011
@@ -4,7 +4,10 @@ Trunk (unreleased changes)
 
 
     MAPREDUCE-279
-   
+    
+    MAPREDUCE-2661. Fix TaskImpl to not access MapTaskImpl. (Ahmed Radwan 
+    via sharad)  
+ 
     MAPREDUCE-2644. NodeManager fails to create containers when NM_LOG_DIR
     is not explicitly set in the Configuration. (Josh Wills via vinodkv)
 

Modified: hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/MapTaskImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/MapTaskImpl.java?rev=1148209&r1=1148208&r2=1148209&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/MapTaskImpl.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/MapTaskImpl.java
Tue Jul 19 07:42:05 2011
@@ -78,4 +78,20 @@ public class MapTaskImpl extends TaskImp
   protected TaskSplitMetaInfo getTaskSplitMetaInfo() {
     return this.taskSplitMetaInfo;
   }
+
+  /**
+   * @return a String formatted as a comma-separated list of splits.
+   */
+  @Override
+  protected String getSplitsAsString() {
+    String[] splits = getTaskSplitMetaInfo().getLocations();
+    if (splits == null || splits.length == 0)
+    return "";
+    StringBuilder sb = new StringBuilder();
+    for (int i = 0; i < splits.length; i++) {
+      if (i != 0) sb.append(",");
+      sb.append(splits[i]);
+    }
+    return sb.toString();
+  }
 }

Modified: hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskImpl.java?rev=1148209&r1=1148208&r2=1148209&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskImpl.java
(original)
+++ hadoop/common/branches/MR-279/mapreduce/mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskImpl.java
Tue Jul 19 07:42:05 2011
@@ -601,7 +601,18 @@ public abstract class TaskImpl implement
         taId == null ? null : TypeConverter.fromYarn(taId));
     return taskFailedEvent;
   }
-  
+
+  /**
+  * @return a String representation of the splits.
+  *
+  * Subclasses can override this method to provide their own representations
+  * of splits (if any).
+  *
+  */
+  protected String getSplitsAsString(){
+	  return "";
+  }
+
   private static class InitialScheduleTransition
     implements SingleArcTransition<TaskImpl, TaskEvent> {
 
@@ -612,23 +623,11 @@ public abstract class TaskImpl implement
       TaskStartedEvent tse = new TaskStartedEvent(
           TypeConverter.fromYarn(task.taskId), task.getLaunchTime(),
           TypeConverter.fromYarn(task.taskId.getTaskType()),
-          task instanceof MapTaskImpl ? splitsAsString(((MapTaskImpl) task) //TODO Should
not be accessing MapTaskImpl
-              .getTaskSplitMetaInfo().getLocations()) : "");
+          task.getSplitsAsString());
       task.eventHandler
           .handle(new JobHistoryEvent(task.taskId.getJobId(), tse));
       task.historyTaskStartGenerated = true;
     }
-    
-    private String splitsAsString(String[] splits) {
-      if (splits == null || splits.length == 0)
-        return "";
-      StringBuilder sb = new StringBuilder();
-      for (int i = 0; i < splits.length; i++) {
-        if (i != 0) sb.append(",");
-        sb.append(splits[i]);
-      }
-      return sb.toString();
-    }
   }
 
   // Used when creating a new attempt while one is already running.



Mime
View raw message