tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjf...@apache.org
Subject git commit: TEZ-1703. addendum - fix flaky test. (zjffdu)
Date Fri, 31 Oct 2014 05:31:55 GMT
Repository: tez
Updated Branches:
  refs/heads/branch-0.5 351a82513 -> 536ba5e59


TEZ-1703. addendum - fix flaky test. (zjffdu)

(cherry picked from commit 8f8a81f7a17f9018ae4e87bf0fca9d6cdc0a5ba4)


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

Branch: refs/heads/branch-0.5
Commit: 536ba5e5967b5364b35d0cb144cd2a936b72d123
Parents: 351a825
Author: Jeff Zhang <zjffdu@apache.org>
Authored: Fri Oct 31 13:30:10 2014 +0800
Committer: Jeff Zhang <zjffdu@apache.org>
Committed: Fri Oct 31 13:31:34 2014 +0800

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../tez/dag/app/dag/impl/TestVertexImpl.java    | 53 ++++++++------------
 2 files changed, 21 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/536ba5e5/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 612499e..77626f0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -87,6 +87,7 @@ ALL CHANGES:
   TEZ-1711. Don't cache outputSpecList in VertexImpl.getOutputSpecList(taskIndex)
   TEZ-1703. Exception handling for InputInitializer.
   TEZ-1698. Cut down on ResourceCalculatorProcessTree overheads in Tez.
+  TEZ-1703. addendum - fix flaky test.
 
 Release 0.5.1: 2014-10-02
 

http://git-wip-us.apache.org/repos/asf/tez/blob/536ba5e5/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
index ef2c7bd..bdcde73 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/dag/impl/TestVertexImpl.java
@@ -4974,28 +4974,27 @@ public class TestVertexImpl {
     Assert.assertEquals(VertexState.FAILED, v1.getState());
     Assert.assertEquals(VertexTerminationCause.ROOT_INPUT_INIT_FAILURE, v1.getTerminationCause());
   }
-  
+
   @SuppressWarnings("unchecked")
   @Test(timeout = 5000)
   public void testExceptionFromII_InitFailedAfterInitialized() throws AMUserCodeException
{
     useCustomInitializer = true;
-    customInitializer = new EventHandlingRootInputInitializer(null, IIExceptionLocation.Initialize2);
-    EventHandlingRootInputInitializer initializer =
-        (EventHandlingRootInputInitializer) customInitializer;
     setupPreDagCreation();
     dagPlan = createDAGPlanWithIIException();
     setupPostDagCreation();
 
-    VertexImplWithRunningInputInitializer v1 =
-        (VertexImplWithRunningInputInitializer) vertices.get("vertex1");
-    // INIT_SUCCEEDED followed by INIT_FAILURE
+    VertexImplWithControlledInitializerManager v1 =
+        (VertexImplWithControlledInitializerManager)vertices.get("vertex1");
     initVertex(v1);
-    dispatcher.getEventHandler().handle(new VertexEventRootInputInitialized(
-        v1.getVertexId(), "input1", null));
+    RootInputInitializerManagerControlled initializerManager1 = v1.getRootInputInitializerManager();
+    initializerManager1.completeInputInitialization(0);
+    Assert.assertEquals(VertexState.INITED, v1.getState());
+    String errorMsg = "ErrorWhenInitFailureAtInited";
+    dispatcher.getEventHandler().handle(new VertexEventRootInputFailed(v1.getVertexId(),
"input1",
+        new AMUserCodeException(Source.InputInitializer, new Exception(errorMsg))));
     dispatcher.await();
-
     String diagnostics = StringUtils.join(v1.getDiagnostics(), ",");
-    assertTrue(diagnostics.contains(IIExceptionLocation.Initialize2.name()));
+    assertTrue(diagnostics.contains(errorMsg));
     Assert.assertEquals(VertexState.FAILED, v1.getState());
     Assert.assertEquals(VertexTerminationCause.ROOT_INPUT_INIT_FAILURE, v1.getTerminationCause());
   }
@@ -5004,24 +5003,23 @@ public class TestVertexImpl {
   @Test(timeout = 5000)
   public void testExceptionFromII_InitFailedAfterRunning() throws AMUserCodeException {
     useCustomInitializer = true;
-    customInitializer = new EventHandlingRootInputInitializer(null, IIExceptionLocation.Initialize2);
-    EventHandlingRootInputInitializer initializer =
-        (EventHandlingRootInputInitializer) customInitializer;
     setupPreDagCreation();
     dagPlan = createDAGPlanWithIIException();
     setupPostDagCreation();
 
-    VertexImplWithRunningInputInitializer v1 =
-        (VertexImplWithRunningInputInitializer) vertices.get("vertex1");
+    VertexImplWithControlledInitializerManager v1 =
+        (VertexImplWithControlledInitializerManager)vertices.get("vertex1");
     initVertex(v1);
-    dispatcher.getEventHandler().handle(new VertexEventRootInputInitialized(
-        v1.getVertexId(), "input1", null));
-    dispatcher.getEventHandler().handle(new VertexEvent(v1.getVertexId(),
-        VertexEventType.V_START));
+    RootInputInitializerManagerControlled initializerManager1 = v1.getRootInputInitializerManager();
+    initializerManager1.completeInputInitialization(0);
+    startVertex(v1);
+    Assert.assertEquals(VertexState.RUNNING, v1.getState());
+    String errorMsg = "ErrorWhenInitFailureAtRunning";
+    dispatcher.getEventHandler().handle(new VertexEventRootInputFailed(v1.getVertexId(),
"input1",
+        new AMUserCodeException(Source.InputInitializer, new Exception(errorMsg))));
     dispatcher.await();
-
     String diagnostics = StringUtils.join(v1.getDiagnostics(), ",");
-    assertTrue(diagnostics.contains(IIExceptionLocation.Initialize2.name()));
+    assertTrue(diagnostics.contains(errorMsg));
     Assert.assertEquals(VertexState.FAILED, v1.getState());
     Assert.assertEquals(VertexTerminationCause.ROOT_INPUT_INIT_FAILURE, v1.getTerminationCause());
   }
@@ -5276,7 +5274,6 @@ public class TestVertexImpl {
   
   public static enum IIExceptionLocation {
     Initialize,
-    Initialize2, // for test case that InputInitFailed after InputInitSucceeded
     HandleInputInitializerEvent,
     OnVertexStateUpdated
   }
@@ -5314,16 +5311,6 @@ public class TestVertexImpl {
       if (exLocation == IIExceptionLocation.Initialize) {
         throw new Exception(exLocation.name());
       }
-      if (exLocation == IIExceptionLocation.Initialize2) {
-        try {
-          Thread.sleep(1000);
-        } catch (InterruptedException e) {
-          // InputInitializerManager is been shutdown if Initialized succeeded,
-          // catch the exception and throw the exception to simulate the case that 
-          // init failure after init succeeded
-          throw new Exception(exLocation.name());
-        }
-      }
       context.registerForVertexStateUpdates("vertex1", null);
       initStarted.set(true);
       lock.lock();


Mime
View raw message