tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ss...@apache.org
Subject git commit: TEZ-1682. Tez AM hangs at times when there are task failures. (sseth)
Date Sat, 18 Oct 2014 00:49:20 GMT
Repository: tez
Updated Branches:
  refs/heads/master c942d0ca7 -> 9220170dd


TEZ-1682. Tez AM hangs at times when there are task failures. (sseth)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/9220170d
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/9220170d
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/9220170d

Branch: refs/heads/master
Commit: 9220170dd87e26542bcfe3bbdc29871625535e1f
Parents: c942d0c
Author: Siddharth Seth <sseth@apache.org>
Authored: Fri Oct 17 17:49:05 2014 -0700
Committer: Siddharth Seth <sseth@apache.org>
Committed: Fri Oct 17 17:49:05 2014 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/tez/dag/app/dag/impl/TaskImpl.java   |  5 +--
 .../tez/dag/app/dag/impl/TestTaskImpl.java      | 47 +++++++++++++++++++-
 3 files changed, 48 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/9220170d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8f97867..f204057 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -40,6 +40,7 @@ ALL CHANGES:
   TEZ-1462. Remove unnecessary SuppressWarnings.
   TEZ-1633. Fixed expected values in TestTaskRecovery.testRecovery_OneTAStarted.
   TEZ-1669. yarn-swimlanes.sh throws error post TEZ-1556.
+  TEZ-1682. Tez AM hangs at times when there are task failures.
 
 Release 0.5.1: 2014-10-02
 

http://git-wip-us.apache.org/repos/asf/tez/blob/9220170d/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
index f67f070..4c5e90f 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/TaskImpl.java
@@ -855,7 +855,8 @@ public class TaskImpl implements Task, EventHandler<TaskEvent> {
       }
       if (oldState != getInternalState()) {
         LOG.info(taskId + " Task Transitioned from " + oldState + " to "
-            + getInternalState());
+            + getInternalState() + " due to event "
+            + event.getType());
       }
     } finally {
       writeLock.unlock();
@@ -1522,8 +1523,6 @@ public class TaskImpl implements Task, EventHandler<TaskEvent>
{
         task.killUnfinishedAttempt
             (attempt, "Task KILL is received. Killing attempt!");
       }
-      task.taskAttemptStatus.clear();
-      
     }
   }
 

http://git-wip-us.apache.org/repos/asf/tez/blob/9220170d/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskImpl.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskImpl.java
index 63cd9c5..1453d14 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskImpl.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestTaskImpl.java
@@ -31,6 +31,7 @@ import static org.mockito.Mockito.eq;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -289,9 +290,27 @@ public class TestTaskImpl {
     killTask(taskId);
     mockTask.handle(new TaskEventTAUpdate(mockTask.getLastAttempt().getID(),
         TaskEventType.T_ATTEMPT_KILLED));
+
     assertEquals(TaskStateInternal.KILLED, mockTask.getInternalState());
+    verifyOutgoingEvents(eventHandler.events, VertexEventType.V_TASK_COMPLETED);
   }
-  
+
+  @Test(timeout = 5000)
+  public void testKillRunningTaskPreviousKilledAttempts() {
+    LOG.info("--- START: testKillRunningTaskPreviousKilledAttempts ---");
+    TezTaskID taskId = getNewTaskID();
+    scheduleTaskAttempt(taskId);
+    launchTaskAttempt(mockTask.getLastAttempt().getID());
+    killRunningTaskAttempt(mockTask.getLastAttempt().getID());
+    assertEquals(TaskStateInternal.RUNNING, mockTask.getInternalState());
+    killTask(taskId);
+    mockTask.handle(new TaskEventTAUpdate(mockTask.getLastAttempt().getID(),
+        TaskEventType.T_ATTEMPT_KILLED));
+
+    assertEquals(TaskStateInternal.KILLED, mockTask.getInternalState());
+    verifyOutgoingEvents(eventHandler.events, VertexEventType.V_TASK_COMPLETED);
+  }
+
   /**
    * {@link TaskState#RUNNING}->{@link TaskState#KILLED}
    */
@@ -545,9 +564,33 @@ public class TestTaskImpl {
     assertEquals(1, mockTask.getDiagnostics().size());
     assertTrue(mockTask.getDiagnostics().get(0).contains(TaskTerminationCause.OTHER_TASK_FAILURE.name()));
   }
-  
+
   // TODO Add test to validate the correct commit attempt.
 
+
+  /* Verifies that the specified event types, exist. Does not ensure they are the only ones,
however */
+  private void verifyOutgoingEvents(List<Event> events,
+                                    Enum<?>... expectedTypes) {
+
+    List<Enum<?>> expectedTypeList = new LinkedList<Enum<?>>();
+    for (Enum<?> expectedType : expectedTypes) {
+      expectedTypeList.add(expectedType);
+    }
+    for (Event event : events) {
+      Iterator<Enum<?>> typeIter = expectedTypeList.iterator();
+      while (typeIter.hasNext()) {
+        Enum<?> expectedType = typeIter.next();
+        if (event.getType() == expectedType) {
+          typeIter.remove();
+          // Move to the next event.
+          break;
+        }
+      }
+    }
+    assertTrue("Did not find types : " + expectedTypeList
+        + " in outgoing event list", expectedTypeList.isEmpty());
+  }
+
   @SuppressWarnings("rawtypes")
   private class MockTaskImpl extends TaskImpl {
 


Mime
View raw message