Search in sources :

Example 6 with DAGEventStartDag

use of org.apache.tez.dag.app.dag.event.DAGEventStartDag 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)

Example 7 with DAGEventStartDag

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

the class TestDAGImpl method testEdgeManager_RouteDataMovementEventToDestinationWithLegacyRouting.

@SuppressWarnings("unchecked")
@Test(timeout = 5000)
public void testEdgeManager_RouteDataMovementEventToDestinationWithLegacyRouting() {
    // Remove after legacy routing is removed
    setupDAGWithCustomEdge(ExceptionLocation.RouteDataMovementEventToDestination, true);
    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));
    DataMovementEvent daEvent = DataMovementEvent.create(ByteBuffer.wrap(new byte[0]));
    TezEvent tezEvent = new TezEvent(daEvent, new EventMetaData(EventProducerConsumerType.INPUT, "vertex1", "vertex2", 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.RouteDataMovementEventToDestination.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) DataMovementEvent(org.apache.tez.runtime.api.events.DataMovementEvent) 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)

Example 8 with DAGEventStartDag

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

the class TestDAGImpl method testEdgeManager_RouteInputErrorEventToSource.

@SuppressWarnings("unchecked")
@Test(timeout = 5000)
public void testEdgeManager_RouteInputErrorEventToSource() {
    setupDAGWithCustomEdge(ExceptionLocation.RouteInputErrorEventToSource);
    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.RouteInputErrorEventToSource.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)

Example 9 with DAGEventStartDag

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

the class TestDAGImpl method testEdgeManager_GetNumDestinationTaskPhysicalInputs.

@SuppressWarnings("unchecked")
@Test(timeout = 5000)
public void testEdgeManager_GetNumDestinationTaskPhysicalInputs() {
    setupDAGWithCustomEdge(ExceptionLocation.GetNumDestinationTaskPhysicalInputs);
    dispatcher.getEventHandler().handle(new DAGEvent(dagWithCustomEdge.getID(), DAGEventType.DAG_INIT));
    dispatcher.getEventHandler().handle(new DAGEventStartDag(dagWithCustomEdge.getID(), null));
    dispatcher.await();
    VertexImpl v2 = (VertexImpl) dagWithCustomEdge.getVertex("vertex2");
    String diag = StringUtils.join(v2.getDiagnostics(), ",");
    Assert.assertTrue(diag.contains(ExceptionLocation.GetNumDestinationTaskPhysicalInputs.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 10 with DAGEventStartDag

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

the class TestDAGImpl method testEdgeManager_RouteDataMovementEventToDestination.

@SuppressWarnings("unchecked")
@Test(timeout = 5000)
public void testEdgeManager_RouteDataMovementEventToDestination() {
    setupDAGWithCustomEdge(ExceptionLocation.RouteDataMovementEventToDestination);
    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));
    DataMovementEvent daEvent = DataMovementEvent.create(ByteBuffer.wrap(new byte[0]));
    TezEvent tezEvent = new TezEvent(daEvent, new EventMetaData(EventProducerConsumerType.INPUT, "vertex1", "vertex2", ta1.getID()));
    dispatcher.getEventHandler().handle(new VertexEventRouteEvent(v2.getVertexId(), Lists.newArrayList(tezEvent)));
    dispatcher.await();
    v2.getTaskAttemptTezEvents(ta1.getID(), 0, 0, 1000);
    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.RouteDataMovementEventToDestination.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) DataMovementEvent(org.apache.tez.runtime.api.events.DataMovementEvent) 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

DAGEventStartDag (org.apache.tez.dag.app.dag.event.DAGEventStartDag)12 StateChangeNotifierForTest (org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest)8 DAGEvent (org.apache.tez.dag.app.dag.event.DAGEvent)8 Test (org.junit.Test)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 URL (java.net.URL)2 DataMovementEvent (org.apache.tez.runtime.api.events.DataMovementEvent)2 InputReadErrorEvent (org.apache.tez.runtime.api.events.InputReadErrorEvent)2 IOException (java.io.IOException)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1 Condition (java.util.concurrent.locks.Condition)1 ReentrantLock (java.util.concurrent.locks.ReentrantLock)1 TezException (org.apache.tez.dag.api.TezException)1 PlanTaskLocationHint (org.apache.tez.dag.api.records.DAGProtos.PlanTaskLocationHint)1 DAGAppMasterEvent (org.apache.tez.dag.app.dag.event.DAGAppMasterEvent)1 DAGEventTerminateDag (org.apache.tez.dag.app.dag.event.DAGEventTerminateDag)1