hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1492362 - in /hadoop/common/branches/branch-2/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/...
Date Wed, 12 Jun 2013 18:50:46 GMT
Author: tucu
Date: Wed Jun 12 18:50:46 2013
New Revision: 1492362

URL: http://svn.apache.org/r1492362
Log:
MAPREDUCE-5304. mapreduce.Job killTask/failTask/getTaskCompletionEvents methods have incompatible
signature changes. (kkambatl via tucu)

Modified:
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskCompletionEvent.java
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java
    hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt?rev=1492362&r1=1492361&r2=1492362&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/CHANGES.txt Wed Jun 12 18:50:46
2013
@@ -430,6 +430,9 @@ Release 2.1.0-beta - UNRELEASED
 
     MAPREDUCE-5312. TestRMNMInfo is failing. (sandyr via tucu)
 
+    MAPREDUCE-5304. mapreduce.Job killTask/failTask/getTaskCompletionEvents 
+    methods have incompatible signature changes. (kkambatl via tucu)
+
 Release 2.0.5-alpha - 06/06/2013
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskCompletionEvent.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskCompletionEvent.java?rev=1492362&r1=1492361&r2=1492362&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskCompletionEvent.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskCompletionEvent.java
Wed Jun 12 18:50:46 2013
@@ -62,8 +62,9 @@ public class TaskCompletionEvent 
     super(eventId, taskId, idWithinJob, isMap, org.apache.hadoop.mapreduce.
           TaskCompletionEvent.Status.valueOf(status.name()), taskTrackerHttp);
   }
-  
-  static TaskCompletionEvent downgrade(
+
+  @Private
+  public static TaskCompletionEvent downgrade(
     org.apache.hadoop.mapreduce.TaskCompletionEvent event) {
     return new TaskCompletionEvent(event.getEventId(),
       TaskAttemptID.downgrade(event.getTaskAttemptId()),event.idWithinJob(),

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java?rev=1492362&r1=1492361&r2=1492362&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java
Wed Jun 12 18:50:46 2013
@@ -675,13 +675,20 @@ public class Job extends JobContextImpl 
    * Get events indicating completion (success/failure) of component tasks.
    *  
    * @param startFrom index to start fetching events from
-   * @return an array of {@link TaskCompletionEvent}s
+   * @return an array of {@link org.apache.hadoop.mapred.TaskCompletionEvent}s
    * @throws IOException
    */
-  public TaskCompletionEvent[] getTaskCompletionEvents(final int startFrom) 
-      throws IOException {
+  public org.apache.hadoop.mapred.TaskCompletionEvent[]
+    getTaskCompletionEvents(final int startFrom) throws IOException {
     try {
-      return getTaskCompletionEvents(startFrom, 10);
+      TaskCompletionEvent[] events = getTaskCompletionEvents(startFrom, 10);
+      org.apache.hadoop.mapred.TaskCompletionEvent[] retEvents =
+          new org.apache.hadoop.mapred.TaskCompletionEvent[events.length];
+      for (int i = 0; i < events.length; i++) {
+        retEvents[i] = org.apache.hadoop.mapred.TaskCompletionEvent.downgrade
+            (events[i]);
+      }
+      return retEvents;
     } catch (InterruptedException ie) {
       throw new IOException(ie);
     }
@@ -689,17 +696,19 @@ public class Job extends JobContextImpl 
 
   /**
    * Kill indicated task attempt.
-   * 
-   * @param taskId the id of the task to be terminated.
-   * @throws IOException
+   * @param taskId the id of the task to kill.
+   * @param shouldFail if <code>true</code> the task is failed and added
+   *                   to failed tasks list, otherwise it is just killed,
+   *                   w/o affecting job failure status.
    */
-  public boolean killTask(final TaskAttemptID taskId) 
-      throws IOException {
+  @Private
+  public boolean killTask(final TaskAttemptID taskId,
+                          final boolean shouldFail) throws IOException {
     ensureState(JobState.RUNNING);
     try {
       return ugi.doAs(new PrivilegedExceptionAction<Boolean>() {
         public Boolean run() throws IOException, InterruptedException {
-          return cluster.getClient().killTask(taskId, false);
+          return cluster.getClient().killTask(taskId, shouldFail);
         }
       });
     }
@@ -709,25 +718,25 @@ public class Job extends JobContextImpl 
   }
 
   /**
+   * Kill indicated task attempt.
+   * 
+   * @param taskId the id of the task to be terminated.
+   * @throws IOException
+   */
+  public void killTask(final TaskAttemptID taskId)
+      throws IOException {
+    killTask(taskId, false);
+  }
+
+  /**
    * Fail indicated task attempt.
    * 
    * @param taskId the id of the task to be terminated.
    * @throws IOException
    */
-  public boolean failTask(final TaskAttemptID taskId) 
+  public void failTask(final TaskAttemptID taskId)
       throws IOException {
-    ensureState(JobState.RUNNING);
-    try {
-      return ugi.doAs(new PrivilegedExceptionAction<Boolean>() {
-        @Override
-        public Boolean run() throws IOException, InterruptedException {
-          return cluster.getClient().killTask(taskId, true);
-        }
-      });
-    }
-    catch (InterruptedException ie) {
-      throw new IOException(ie);
-    }
+    killTask(taskId, true);
   }
 
   /**

Modified: hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java?rev=1492362&r1=1492361&r2=1492362&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java
Wed Jun 12 18:50:46 2013
@@ -317,7 +317,7 @@ public class CLI extends Configured impl
         Job job = cluster.getJob(taskID.getJobID());
         if (job == null) {
           System.out.println("Could not find job " + jobid);
-        } else if (job.killTask(taskID)) {
+        } else if (job.killTask(taskID, false)) {
           System.out.println("Killed task " + taskid);
           exitCode = 0;
         } else {
@@ -329,7 +329,7 @@ public class CLI extends Configured impl
         Job job = cluster.getJob(taskID.getJobID());
         if (job == null) {
             System.out.println("Could not find job " + jobid);
-        } else if(job.failTask(taskID)) {
+        } else if(job.killTask(taskID, true)) {
           System.out.println("Killed task " + taskID + " by failing it");
           exitCode = 0;
         } else {



Mime
View raw message