Search in sources :

Example 16 with VertexInitializedEvent

use of org.apache.tez.dag.history.events.VertexInitializedEvent in project tez by apache.

the class TestHistoryEventTimelineConversion method testConvertVertexInitializedEvent.

@SuppressWarnings("unchecked")
@Test(timeout = 5000)
public void testConvertVertexInitializedEvent() {
    long initRequestedTime = random.nextLong();
    long initedTime = random.nextLong();
    int numTasks = random.nextInt();
    VertexInitializedEvent event = new VertexInitializedEvent(tezVertexID, "v1", initRequestedTime, initedTime, numTasks, "proc", null, null, new ServicePluginInfo().setContainerLauncherName("abc").setTaskSchedulerName("def").setTaskCommunicatorName("ghi").setContainerLauncherClassName("abc1").setTaskSchedulerClassName("def1").setTaskCommunicatorClassName("ghi1"));
    List<TimelineEntity> entities = HistoryEventTimelineConversion.convertToTimelineEntities(event);
    Assert.assertEquals(1, entities.size());
    TimelineEntity timelineEntity = entities.get(0);
    Assert.assertEquals(EntityTypes.TEZ_VERTEX_ID.name(), timelineEntity.getEntityType());
    Assert.assertEquals(tezVertexID.toString(), timelineEntity.getEntityId());
    Assert.assertEquals(initedTime, timelineEntity.getStartTime().longValue());
    Assert.assertEquals(1, timelineEntity.getRelatedEntities().size());
    Assert.assertTrue(timelineEntity.getRelatedEntities().get(EntityTypes.TEZ_DAG_ID.name()).contains(tezDAGID.toString()));
    Assert.assertEquals(2, timelineEntity.getPrimaryFilters().size());
    Assert.assertTrue(timelineEntity.getPrimaryFilters().get(ATSConstants.APPLICATION_ID).contains(applicationId.toString()));
    Assert.assertTrue(timelineEntity.getPrimaryFilters().get(EntityTypes.TEZ_DAG_ID.name()).contains(tezDAGID.toString()));
    Assert.assertEquals(1, timelineEntity.getEvents().size());
    TimelineEvent timelineEvent = timelineEntity.getEvents().get(0);
    Assert.assertEquals(HistoryEventType.VERTEX_INITIALIZED.name(), timelineEvent.getEventType());
    Assert.assertEquals(initedTime, timelineEvent.getTimestamp());
    Assert.assertEquals("v1", timelineEntity.getOtherInfo().get(ATSConstants.VERTEX_NAME));
    Assert.assertEquals("proc", timelineEntity.getOtherInfo().get(ATSConstants.PROCESSOR_CLASS_NAME));
    Assert.assertEquals(initedTime, ((Long) timelineEntity.getOtherInfo().get(ATSConstants.INIT_TIME)).longValue());
    Assert.assertEquals(initRequestedTime, ((Long) timelineEntity.getOtherInfo().get(ATSConstants.INIT_REQUESTED_TIME)).longValue());
    Assert.assertEquals(initedTime, ((Long) timelineEntity.getOtherInfo().get(ATSConstants.INIT_TIME)).longValue());
    Assert.assertEquals(numTasks, ((Integer) timelineEntity.getOtherInfo().get(ATSConstants.NUM_TASKS)).intValue());
    Assert.assertNotNull(timelineEntity.getOtherInfo().get(ATSConstants.SERVICE_PLUGIN));
    Assert.assertEquals("abc", ((Map<String, Object>) timelineEntity.getOtherInfo().get(ATSConstants.SERVICE_PLUGIN)).get(ATSConstants.CONTAINER_LAUNCHER_NAME));
    Assert.assertEquals("def", ((Map<String, Object>) timelineEntity.getOtherInfo().get(ATSConstants.SERVICE_PLUGIN)).get(ATSConstants.TASK_SCHEDULER_NAME));
    Assert.assertEquals("ghi", ((Map<String, Object>) timelineEntity.getOtherInfo().get(ATSConstants.SERVICE_PLUGIN)).get(ATSConstants.TASK_COMMUNICATOR_NAME));
    Assert.assertEquals("abc1", ((Map<String, Object>) timelineEntity.getOtherInfo().get(ATSConstants.SERVICE_PLUGIN)).get(ATSConstants.CONTAINER_LAUNCHER_CLASS_NAME));
    Assert.assertEquals("def1", ((Map<String, Object>) timelineEntity.getOtherInfo().get(ATSConstants.SERVICE_PLUGIN)).get(ATSConstants.TASK_SCHEDULER_CLASS_NAME));
    Assert.assertEquals("ghi1", ((Map<String, Object>) timelineEntity.getOtherInfo().get(ATSConstants.SERVICE_PLUGIN)).get(ATSConstants.TASK_COMMUNICATOR_CLASS_NAME));
}
Also used : ServicePluginInfo(org.apache.tez.dag.app.dag.impl.ServicePluginInfo) TimelineEvent(org.apache.hadoop.yarn.api.records.timeline.TimelineEvent) VertexInitializedEvent(org.apache.tez.dag.history.events.VertexInitializedEvent) TimelineEntity(org.apache.hadoop.yarn.api.records.timeline.TimelineEntity) Test(org.junit.Test)

Aggregations

VertexInitializedEvent (org.apache.tez.dag.history.events.VertexInitializedEvent)16 VertexConfigurationDoneEvent (org.apache.tez.dag.history.events.VertexConfigurationDoneEvent)12 VertexStartedEvent (org.apache.tez.dag.history.events.VertexStartedEvent)12 TaskStartedEvent (org.apache.tez.dag.history.events.TaskStartedEvent)10 TezEvent (org.apache.tez.runtime.api.impl.TezEvent)10 Test (org.junit.Test)10 DAGInitializedEvent (org.apache.tez.dag.history.events.DAGInitializedEvent)9 DAGStartedEvent (org.apache.tez.dag.history.events.DAGStartedEvent)9 TaskAttemptStartedEvent (org.apache.tez.dag.history.events.TaskAttemptStartedEvent)9 TaskFinishedEvent (org.apache.tez.dag.history.events.TaskFinishedEvent)8 VertexFinishedEvent (org.apache.tez.dag.history.events.VertexFinishedEvent)8 VertexRecoveryData (org.apache.tez.dag.app.RecoveryParser.VertexRecoveryData)7 ArrayList (java.util.ArrayList)6 TaskRecoveryData (org.apache.tez.dag.app.RecoveryParser.TaskRecoveryData)6 DAGFinishedEvent (org.apache.tez.dag.history.events.DAGFinishedEvent)6 TaskAttemptFinishedEvent (org.apache.tez.dag.history.events.TaskAttemptFinishedEvent)6 TezTaskID (org.apache.tez.dag.records.TezTaskID)6 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)5 NodeId (org.apache.hadoop.yarn.api.records.NodeId)5 DAGSubmittedEvent (org.apache.tez.dag.history.events.DAGSubmittedEvent)5