Search in sources :

Example 6 with DAGEvent

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

the class TestDAGImpl method initDAG.

private void initDAG(DAGImpl impl) {
    impl.handle(new DAGEvent(impl.getID(), DAGEventType.DAG_INIT));
    Assert.assertEquals(DAGState.INITED, impl.getState());
}
Also used : DAGEvent(org.apache.tez.dag.app.dag.event.DAGEvent)

Example 7 with DAGEvent

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

the class TestDAGImpl method testEdgeManager_GetNumSourceTaskPhysicalOutputs.

@SuppressWarnings("unchecked")
@Test(timeout = 5000)
public void testEdgeManager_GetNumSourceTaskPhysicalOutputs() {
    setupDAGWithCustomEdge(ExceptionLocation.GetNumSourceTaskPhysicalOutputs);
    dispatcher.getEventHandler().handle(new DAGEvent(dagWithCustomEdge.getID(), DAGEventType.DAG_INIT));
    dispatcher.getEventHandler().handle(new DAGEventStartDag(dagWithCustomEdge.getID(), null));
    dispatcher.await();
    // After TEZ-1711, all task attempts of v1 fail which result in task fail, and finally
    // dag failed.
    Assert.assertEquals(DAGState.FAILED, dagWithCustomEdge.getState());
    VertexImpl v1 = (VertexImpl) dagWithCustomEdge.getVertex("vertex1");
    String diag = StringUtils.join(v1.getDiagnostics(), ",");
    Assert.assertTrue(diag.contains(ExceptionLocation.GetNumSourceTaskPhysicalOutputs.name()));
}
Also used : DAGEvent(org.apache.tez.dag.app.dag.event.DAGEvent) DAGEventStartDag(org.apache.tez.dag.app.dag.event.DAGEventStartDag) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test) StateChangeNotifierForTest(org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest)

Example 8 with DAGEvent

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

the class TestCommit method initDAG.

private void initDAG(DAGImpl dag) {
    dag.handle(new DAGEvent(dag.getID(), DAGEventType.DAG_INIT));
    Assert.assertEquals(DAGState.INITED, dag.getState());
}
Also used : DAGEvent(org.apache.tez.dag.app.dag.event.DAGEvent)

Example 9 with DAGEvent

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

the class TestDAGImpl method testNonExistEdgeManagerPlugin.

@Test(timeout = 5000)
public void testNonExistEdgeManagerPlugin() {
    dagPlan = createDAGWithNonExistEdgeManager();
    dag = new DAGImpl(dagId, conf, dagPlan, dispatcher.getEventHandler(), taskCommunicatorManagerInterface, fsTokens, clock, "user", thh, appContext);
    dag.entityUpdateTracker = new StateChangeNotifierForTest(dag);
    doReturn(dag).when(appContext).getCurrentDAG();
    dag.handle(new DAGEvent(dagId, DAGEventType.DAG_INIT));
    Assert.assertEquals(DAGState.FAILED, dag.getState());
    Assert.assertEquals(DAGTerminationCause.INIT_FAILURE, dag.getTerminationCause());
    Assert.assertTrue(StringUtils.join(dag.getDiagnostics(), "").contains("java.lang.ClassNotFoundException: non-exist-edge-manager"));
}
Also used : DAGEvent(org.apache.tez.dag.app.dag.event.DAGEvent) StateChangeNotifierForTest(org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest) Test(org.junit.Test) StateChangeNotifierForTest(org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest)

Example 10 with DAGEvent

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

the class TestDAGImpl method testEdgeManager_GetNumDestinationConsumerTasks.

@SuppressWarnings("unchecked")
@Test(timeout = 5000)
public void testEdgeManager_GetNumDestinationConsumerTasks() {
    setupDAGWithCustomEdge(ExceptionLocation.GetNumDestinationConsumerTasks);
    dispatcher.getEventHandler().handle(new DAGEvent(dagWithCustomEdge.getID(), DAGEventType.DAG_INIT));
    dispatcher.getEventHandler().handle(new DAGEventStartDag(dagWithCustomEdge.getID(), null));
    dispatcher.await();
    Assert.assertEquals(DAGState.RUNNING, dagWithCustomEdge.getState());
    VertexImpl v1 = (VertexImpl) dagWithCustomEdge.getVertex("vertex1");
    VertexImpl v2 = (VertexImpl) dagWithCustomEdge.getVertex("vertex2");
    dispatcher.await();
    Task t1 = v2.getTask(0);
    TaskAttemptImpl ta1 = (TaskAttemptImpl) t1.getAttempt(TezTaskAttemptID.getInstance(t1.getTaskId(), 0));
    InputReadErrorEvent ireEvent = InputReadErrorEvent.create("", 0, 0);
    TezEvent tezEvent = new TezEvent(ireEvent, new EventMetaData(EventProducerConsumerType.INPUT, "vertex2", "vertex1", ta1.getID()));
    dispatcher.getEventHandler().handle(new VertexEventRouteEvent(v2.getVertexId(), Lists.newArrayList(tezEvent)));
    dispatcher.await();
    // 
    Assert.assertEquals(VertexState.FAILED, v2.getState());
    Assert.assertEquals(VertexState.KILLED, v1.getState());
    String diag = StringUtils.join(v2.getDiagnostics(), ",");
    Assert.assertTrue(diag.contains(ExceptionLocation.GetNumDestinationConsumerTasks.name()));
}
Also used : DAGEvent(org.apache.tez.dag.app.dag.event.DAGEvent) Task(org.apache.tez.dag.app.dag.Task) DAGEventStartDag(org.apache.tez.dag.app.dag.event.DAGEventStartDag) InputReadErrorEvent(org.apache.tez.runtime.api.events.InputReadErrorEvent) TezEvent(org.apache.tez.runtime.api.impl.TezEvent) VertexEventRouteEvent(org.apache.tez.dag.app.dag.event.VertexEventRouteEvent) ByteString(com.google.protobuf.ByteString) EventMetaData(org.apache.tez.runtime.api.impl.EventMetaData) Test(org.junit.Test) StateChangeNotifierForTest(org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest)

Aggregations

DAGEvent (org.apache.tez.dag.app.dag.event.DAGEvent)20 Test (org.junit.Test)13 StateChangeNotifierForTest (org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest)11 DAGEventStartDag (org.apache.tez.dag.app.dag.event.DAGEventStartDag)8 ByteString (com.google.protobuf.ByteString)7 Task (org.apache.tez.dag.app.dag.Task)5 VertexEventRouteEvent (org.apache.tez.dag.app.dag.event.VertexEventRouteEvent)5 EventMetaData (org.apache.tez.runtime.api.impl.EventMetaData)5 TezEvent (org.apache.tez.runtime.api.impl.TezEvent)5 IOException (java.io.IOException)2 DAGEventDiagnosticsUpdate (org.apache.tez.dag.app.dag.event.DAGEventDiagnosticsUpdate)2 VertexEventTaskCompleted (org.apache.tez.dag.app.dag.event.VertexEventTaskCompleted)2 DataMovementEvent (org.apache.tez.runtime.api.events.DataMovementEvent)2 InputReadErrorEvent (org.apache.tez.runtime.api.events.InputReadErrorEvent)2 URL (java.net.URL)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1 InvalidStateTransitonException (org.apache.hadoop.yarn.state.InvalidStateTransitonException)1 LimitExceededException (org.apache.tez.common.counters.LimitExceededException)1 TezException (org.apache.tez.dag.api.TezException)1 TezUncheckedException (org.apache.tez.dag.api.TezUncheckedException)1