You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by zj...@apache.org on 2014/10/31 06:30:41 UTC
git commit: TEZ-1703. addendum - fix flaky test. (zjffdu)
Repository: tez
Updated Branches:
refs/heads/master 4d94652c8 -> 8f8a81f7a
TEZ-1703. addendum - fix flaky test. (zjffdu)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/8f8a81f7
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/8f8a81f7
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/8f8a81f7
Branch: refs/heads/master
Commit: 8f8a81f7a17f9018ae4e87bf0fca9d6cdc0a5ba4
Parents: 4d94652
Author: Jeff Zhang <zj...@apache.org>
Authored: Fri Oct 31 13:30:10 2014 +0800
Committer: Jeff Zhang <zj...@apache.org>
Committed: Fri Oct 31 13:30:10 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/8f8a81f7/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index cbbc0df..3fdd96e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -94,6 +94,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/8f8a81f7/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();