use of org.apache.tez.dag.history.events.DAGStartedEvent in project tez by apache.
the class TestATSHistoryLoggingService method testATSHistoryLoggingServiceShutdown.
@Test(timeout = 20000)
public void testATSHistoryLoggingServiceShutdown() {
atsHistoryLoggingService.start();
TezDAGID tezDAGID = TezDAGID.getInstance(ApplicationId.newInstance(100l, 1), 1);
DAGHistoryEvent historyEvent = new DAGHistoryEvent(tezDAGID, new DAGStartedEvent(tezDAGID, 1001l, "user1", "dagName1"));
for (int i = 0; i < 100; ++i) {
atsHistoryLoggingService.handle(historyEvent);
}
try {
Thread.sleep(2500l);
} catch (InterruptedException e) {
// Do nothing
}
atsHistoryLoggingService.stop();
LOG.info("ATS entitiesSent=" + atsEntitiesCounter + ", timelineInvocations=" + atsInvokeCounter);
Assert.assertTrue(atsEntitiesCounter >= 4);
Assert.assertTrue(atsEntitiesCounter < 20);
}
use of org.apache.tez.dag.history.events.DAGStartedEvent in project tez by apache.
the class TestHistoryEventTimelineConversion method testConvertDAGStartedEvent.
@Test(timeout = 5000)
public void testConvertDAGStartedEvent() {
long startTime = random.nextLong();
String dagName = "testDagName";
DAGStartedEvent event = new DAGStartedEvent(tezDAGID, startTime, user, dagName);
List<TimelineEntity> entities = HistoryEventTimelineConversion.convertToTimelineEntities(event);
Assert.assertEquals(1, entities.size());
TimelineEntity timelineEntity = entities.get(0);
Assert.assertEquals(tezDAGID.toString(), timelineEntity.getEntityId());
Assert.assertEquals(EntityTypes.TEZ_DAG_ID.name(), timelineEntity.getEntityType());
Assert.assertEquals(1, timelineEntity.getEvents().size());
TimelineEvent evt = timelineEntity.getEvents().get(0);
Assert.assertEquals(HistoryEventType.DAG_STARTED.name(), evt.getEventType());
Assert.assertEquals(startTime, evt.getTimestamp());
final Map<String, Set<Object>> primaryFilters = timelineEntity.getPrimaryFilters();
Assert.assertEquals(3, primaryFilters.size());
Assert.assertTrue(primaryFilters.get(ATSConstants.USER).contains(user));
Assert.assertTrue(primaryFilters.get(ATSConstants.APPLICATION_ID).contains(applicationId.toString()));
Assert.assertTrue(primaryFilters.get(ATSConstants.DAG_NAME).contains(dagName));
final Map<String, Object> otherInfo = timelineEntity.getOtherInfo();
Assert.assertEquals(2, otherInfo.size());
Assert.assertEquals(startTime, otherInfo.get(ATSConstants.START_TIME));
Assert.assertEquals(DAGState.RUNNING.name(), otherInfo.get(ATSConstants.STATUS));
}
Aggregations