use of org.apache.tez.dag.app.dag.event.TaskEventTALaunched in project tez by apache.
the class TestVertexImpl method testCompletedStatsCache.
@Test(timeout = 5000)
public void testCompletedStatsCache() {
initAllVertices(VertexState.INITED);
VertexImpl v = vertices.get("vertex2");
startVertex(v);
TezTaskID t1 = TezTaskID.getInstance(v.getVertexId(), 0);
dispatcher.getEventHandler().handle(new TaskEventTALaunched(TezTaskAttemptID.getInstance(t1, 0)));
dispatcher.getEventHandler().handle(new TaskEventTASucceeded(TezTaskAttemptID.getInstance(t1, 0)));
dispatcher.getEventHandler().handle(new VertexEventTaskCompleted(t1, TaskState.SUCCEEDED));
dispatcher.await();
VertexStatistics stats = v.getStatistics();
// Ensure that task 0 is available in completed stats cache
Assert.assertTrue(v.completedTasksStatsCache.taskSet.get(0));
// Reschedule task 0
dispatcher.getEventHandler().handle(new VertexEventTaskReschedule(t1));
dispatcher.await();
Assert.assertEquals(VertexState.RUNNING, v.getState());
// cache should be cleared
Assert.assertTrue(v.completedTasksStatsCache.taskSet.cardinality() == 0);
}
Aggregations