Search in sources :

Example 1 with DAGEventVertexReRunning

use of org.apache.tez.dag.app.dag.event.DAGEventVertexReRunning in project tez by apache.

the class TestDAGImpl method testGroupDAGWithVertexReRunning.

@SuppressWarnings("unchecked")
@Test(timeout = 5000)
public void testGroupDAGWithVertexReRunning() {
    groupDag.getConf().setBoolean(TezConfiguration.TEZ_AM_COMMIT_ALL_OUTPUTS_ON_DAG_SUCCESS, false);
    initDAG(groupDag);
    startDAG(groupDag);
    dispatcher.await();
    Vertex v1 = groupDag.getVertex("vertex1");
    Vertex v2 = groupDag.getVertex("vertex2");
    dispatcher.getEventHandler().handle(new DAGEventVertexCompleted(v1.getVertexId(), VertexState.SUCCEEDED));
    dispatcher.getEventHandler().handle(new DAGEventVertexReRunning(v1.getVertexId()));
    dispatcher.getEventHandler().handle(new DAGEventVertexCompleted(v2.getVertexId(), VertexState.SUCCEEDED));
    dispatcher.await();
    // commit should not happen due to vertex-rerunning
    Assert.assertEquals(0, TotalCountingOutputCommitter.totalCommitCounter);
    dispatcher.getEventHandler().handle(new DAGEventVertexCompleted(v1.getVertexId(), VertexState.SUCCEEDED));
    dispatcher.await();
    // commit happen
    Assert.assertEquals(1, TotalCountingOutputCommitter.totalCommitCounter);
    Assert.assertEquals(2, groupDag.getSuccessfulVertices());
}
Also used : DAGEventVertexReRunning(org.apache.tez.dag.app.dag.event.DAGEventVertexReRunning) Vertex(org.apache.tez.dag.app.dag.Vertex) DAGEventVertexCompleted(org.apache.tez.dag.app.dag.event.DAGEventVertexCompleted) Test(org.junit.Test) StateChangeNotifierForTest(org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest)

Example 2 with DAGEventVertexReRunning

use of org.apache.tez.dag.app.dag.event.DAGEventVertexReRunning in project tez by apache.

the class TestDAGImpl method testGroupDAGWithVertexReRunningAfterCommit.

@SuppressWarnings("unchecked")
@Test(timeout = 5000)
public void testGroupDAGWithVertexReRunningAfterCommit() {
    groupDag.getConf().setBoolean(TezConfiguration.TEZ_AM_COMMIT_ALL_OUTPUTS_ON_DAG_SUCCESS, false);
    initDAG(groupDag);
    startDAG(groupDag);
    dispatcher.await();
    Vertex v1 = groupDag.getVertex("vertex1");
    Vertex v2 = groupDag.getVertex("vertex2");
    dispatcher.getEventHandler().handle(new DAGEventVertexCompleted(v1.getVertexId(), VertexState.SUCCEEDED));
    dispatcher.getEventHandler().handle(new DAGEventVertexCompleted(v2.getVertexId(), VertexState.SUCCEEDED));
    dispatcher.await();
    // vertex group commit happens
    Assert.assertEquals(1, TotalCountingOutputCommitter.totalCommitCounter);
    // dag failed when vertex re-run happens after vertex group commit is done.
    dispatcher.getEventHandler().handle(new DAGEventVertexReRunning(v1.getVertexId()));
    dispatcher.await();
    Assert.assertEquals(DAGState.FAILED, groupDag.getState());
    Assert.assertEquals(DAGTerminationCause.VERTEX_RERUN_AFTER_COMMIT, groupDag.getTerminationCause());
}
Also used : DAGEventVertexReRunning(org.apache.tez.dag.app.dag.event.DAGEventVertexReRunning) Vertex(org.apache.tez.dag.app.dag.Vertex) DAGEventVertexCompleted(org.apache.tez.dag.app.dag.event.DAGEventVertexCompleted) Test(org.junit.Test) StateChangeNotifierForTest(org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest)

Aggregations

StateChangeNotifierForTest (org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest)2 Vertex (org.apache.tez.dag.app.dag.Vertex)2 DAGEventVertexCompleted (org.apache.tez.dag.app.dag.event.DAGEventVertexCompleted)2 DAGEventVertexReRunning (org.apache.tez.dag.app.dag.event.DAGEventVertexReRunning)2 Test (org.junit.Test)2