org.apache.hadoop.yarn.api.records.timeline.TimelineEvent Java Examples

The following examples show how to use org.apache.hadoop.yarn.api.records.timeline.TimelineEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HistoryEventTimelineConversion.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertContainerStoppedEvent(ContainerStoppedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId("tez_"
      + event.getContainerId().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_CONTAINER_ID.name());

  // In case, a container is stopped in a different attempt
  atsEntity.addRelatedEntity(EntityTypes.TEZ_APPLICATION_ATTEMPT.name(),
      "tez_" + event.getApplicationAttemptId().toString());

  TimelineEvent stoppedEvt = new TimelineEvent();
  stoppedEvt.setEventType(HistoryEventType.CONTAINER_STOPPED.name());
  stoppedEvt.setTimestamp(event.getStoppedTime());
  atsEntity.addEvent(stoppedEvt);

  atsEntity.addOtherInfo(ATSConstants.EXIT_STATUS, event.getExitStatus());
  atsEntity.addOtherInfo(ATSConstants.FINISH_TIME, event.getStoppedTime());

  return atsEntity;
}
 
Example #2
Source File: TestTimelineClient.java    From big-c with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity generateEntity() {
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId("entity id");
  entity.setEntityType("entity type");
  entity.setStartTime(System.currentTimeMillis());
  for (int i = 0; i < 2; ++i) {
    TimelineEvent event = new TimelineEvent();
    event.setTimestamp(System.currentTimeMillis());
    event.setEventType("test event type " + i);
    event.addEventInfo("key1", "val1");
    event.addEventInfo("key2", "val2");
    entity.addEvent(event);
  }
  entity.addRelatedEntity("test ref type 1", "test ref id 1");
  entity.addRelatedEntity("test ref type 2", "test ref id 2");
  entity.addPrimaryFilter("pkey1", "pval1");
  entity.addPrimaryFilter("pkey2", "pval2");
  entity.addOtherInfo("okey1", "oval1");
  entity.addOtherInfo("okey2", "oval2");
  entity.setDomainId("domain id 1");
  return entity;
}
 
Example #3
Source File: SystemMetricsPublisher.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void publishContainerFinishedEvent(ContainerFinishedEvent event) {
  TimelineEntity entity = createContainerEntity(event.getContainerId());
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(ContainerMetricsConstants.FINISHED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  Map<String, Object> eventInfo = new HashMap<String, Object>();
  eventInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO,
      event.getDiagnosticsInfo());
  eventInfo.put(ContainerMetricsConstants.EXIT_STATUS_EVENT_INFO,
      event.getContainerExitStatus());
  eventInfo.put(ContainerMetricsConstants.STATE_EVENT_INFO,
      event.getContainerState().toString());
  tEvent.setEventInfo(eventInfo);
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
Example #4
Source File: SystemMetricsPublisher.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void publishContainerCreatedEvent(ContainerCreatedEvent event) {
  TimelineEntity entity = createContainerEntity(event.getContainerId());
  Map<String, Object> entityInfo = new HashMap<String, Object>();
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_MEMORY_ENTITY_INFO,
      event.getAllocatedResource().getMemory());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_VCORE_ENTITY_INFO,
      event.getAllocatedResource().getVirtualCores());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_GCORE_ENTITY_INFO,
      event.getAllocatedResource().getGpuCores());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_HOST_ENTITY_INFO,
      event.getAllocatedNode().getHost());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_PORT_ENTITY_INFO,
      event.getAllocatedNode().getPort());
  entityInfo.put(ContainerMetricsConstants.ALLOCATED_PRIORITY_ENTITY_INFO,
      event.getAllocatedPriority().getPriority());
  entityInfo.put(
    ContainerMetricsConstants.ALLOCATED_HOST_HTTP_ADDRESS_ENTITY_INFO,
    event.getNodeHttpAddress());
  entity.setOtherInfo(entityInfo);
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(ContainerMetricsConstants.CREATED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
Example #5
Source File: SystemMetricsPublisher.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void
    publishAppAttemptRegisteredEvent(AppAttemptRegisteredEvent event) {
  TimelineEntity entity =
      createAppAttemptEntity(event.getApplicationAttemptId());
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(
      AppAttemptMetricsConstants.REGISTERED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  Map<String, Object> eventInfo = new HashMap<String, Object>();
  eventInfo.put(
      AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO,
      event.getTrackingUrl());
  eventInfo.put(
      AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO,
      event.getOriginalTrackingURL());
  eventInfo.put(AppAttemptMetricsConstants.HOST_EVENT_INFO,
      event.getHost());
  eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO,
      event.getRpcPort());
  eventInfo.put(
      AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
      event.getMasterContainerId().toString());
  tEvent.setEventInfo(eventInfo);
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
Example #6
Source File: TestTimelineClient.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity generateEntity() {
  TimelineEntity entity = new TimelineEntity();
  entity.setEntityId("entity id");
  entity.setEntityType("entity type");
  entity.setStartTime(System.currentTimeMillis());
  for (int i = 0; i < 2; ++i) {
    TimelineEvent event = new TimelineEvent();
    event.setTimestamp(System.currentTimeMillis());
    event.setEventType("test event type " + i);
    event.addEventInfo("key1", "val1");
    event.addEventInfo("key2", "val2");
    entity.addEvent(event);
  }
  entity.addRelatedEntity("test ref type 1", "test ref id 1");
  entity.addRelatedEntity("test ref type 2", "test ref id 2");
  entity.addPrimaryFilter("pkey1", "pval1");
  entity.addPrimaryFilter("pkey2", "pval2");
  entity.addOtherInfo("okey1", "oval1");
  entity.addOtherInfo("okey2", "oval2");
  entity.setDomainId("domain id 1");
  return entity;
}
 
Example #7
Source File: TestTimelineWebServices.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetEvents() throws Exception {
  WebResource r = resource();
  ClientResponse response = r.path("ws").path("v1").path("timeline")
      .path("type_1").path("events")
      .queryParam("entityId", "id_1")
      .accept(MediaType.APPLICATION_JSON)
      .get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  TimelineEvents events = response.getEntity(TimelineEvents.class);
  Assert.assertNotNull(events);
  Assert.assertEquals(1, events.getAllEvents().size());
  TimelineEvents.EventsOfOneEntity partEvents = events.getAllEvents().get(0);
  Assert.assertEquals(2, partEvents.getEvents().size());
  TimelineEvent event1 = partEvents.getEvents().get(0);
  Assert.assertEquals(456l, event1.getTimestamp());
  Assert.assertEquals("end_event", event1.getEventType());
  Assert.assertEquals(1, event1.getEventInfo().size());
  TimelineEvent event2 = partEvents.getEvents().get(1);
  Assert.assertEquals(123l, event2.getTimestamp());
  Assert.assertEquals("start_event", event2.getEventType());
  Assert.assertEquals(0, event2.getEventInfo().size());
}
 
Example #8
Source File: SystemMetricsPublisher.java    From big-c with Apache License 2.0 6 votes vote down vote up
private void
    publishAppAttemptRegisteredEvent(AppAttemptRegisteredEvent event) {
  TimelineEntity entity =
      createAppAttemptEntity(event.getApplicationAttemptId());
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(
      AppAttemptMetricsConstants.REGISTERED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  Map<String, Object> eventInfo = new HashMap<String, Object>();
  eventInfo.put(
      AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO,
      event.getTrackingUrl());
  eventInfo.put(
      AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO,
      event.getOriginalTrackingURL());
  eventInfo.put(AppAttemptMetricsConstants.HOST_EVENT_INFO,
      event.getHost());
  eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO,
      event.getRpcPort());
  eventInfo.put(
      AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
      event.getMasterContainerId().toString());
  tEvent.setEventInfo(eventInfo);
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
Example #9
Source File: SystemMetricsPublisher.java    From big-c with Apache License 2.0 6 votes vote down vote up
private void publishAppAttemptFinishedEvent(AppAttemptFinishedEvent event) {
  TimelineEntity entity =
      createAppAttemptEntity(event.getApplicationAttemptId());
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(AppAttemptMetricsConstants.FINISHED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  Map<String, Object> eventInfo = new HashMap<String, Object>();
  eventInfo.put(
      AppAttemptMetricsConstants.TRACKING_URL_EVENT_INFO,
      event.getTrackingUrl());
  eventInfo.put(
      AppAttemptMetricsConstants.ORIGINAL_TRACKING_URL_EVENT_INFO,
      event.getOriginalTrackingURL());
  eventInfo.put(AppAttemptMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO,
      event.getDiagnosticsInfo());
  eventInfo.put(AppAttemptMetricsConstants.FINAL_STATUS_EVENT_INFO,
      event.getFinalApplicationStatus().toString());
  eventInfo.put(AppAttemptMetricsConstants.STATE_EVENT_INFO,
      event.getYarnApplicationAttemptState().toString());
  tEvent.setEventInfo(eventInfo);
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
Example #10
Source File: SystemMetricsPublisher.java    From big-c with Apache License 2.0 6 votes vote down vote up
private void publishContainerFinishedEvent(ContainerFinishedEvent event) {
  TimelineEntity entity = createContainerEntity(event.getContainerId());
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(ContainerMetricsConstants.FINISHED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  Map<String, Object> eventInfo = new HashMap<String, Object>();
  eventInfo.put(ContainerMetricsConstants.DIAGNOSTICS_INFO_EVENT_INFO,
      event.getDiagnosticsInfo());
  eventInfo.put(ContainerMetricsConstants.EXIT_STATUS_EVENT_INFO,
      event.getContainerExitStatus());
  eventInfo.put(ContainerMetricsConstants.STATE_EVENT_INFO,
      event.getContainerState().toString());
  tEvent.setEventInfo(eventInfo);
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
Example #11
Source File: TestHistoryEventTimelineConversion.java    From tez with Apache License 2.0 6 votes vote down vote up
private void assertDagFinishedExtraInfoEntity(long finishTime, TimelineEntity timelineEntity) {
  Assert.assertEquals(EntityTypes.TEZ_DAG_EXTRA_INFO.name(), timelineEntity.getEntityType());
  Assert.assertEquals(tezDAGID.toString(), timelineEntity.getEntityId());

  Assert.assertEquals(1, timelineEntity.getRelatedEntities().size());
  Assert.assertTrue(
      timelineEntity.getRelatedEntities().get(ATSConstants.TEZ_DAG_ID).contains(
          tezDAGID.toString()));

  Assert.assertEquals(1, timelineEntity.getEvents().size());
  TimelineEvent timelineEvent = timelineEntity.getEvents().get(0);
  Assert.assertEquals(HistoryEventType.DAG_FINISHED.name(), timelineEvent.getEventType());
  Assert.assertEquals(finishTime, timelineEvent.getTimestamp());

  Assert.assertTrue(timelineEntity.getOtherInfo().containsKey(ATSConstants.COUNTERS));
}
 
Example #12
Source File: TestTimelineWebServices.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetEvents() throws Exception {
  WebResource r = resource();
  ClientResponse response = r.path("ws").path("v1").path("timeline")
      .path("type_1").path("events")
      .queryParam("entityId", "id_1")
      .accept(MediaType.APPLICATION_JSON)
      .get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  TimelineEvents events = response.getEntity(TimelineEvents.class);
  Assert.assertNotNull(events);
  Assert.assertEquals(1, events.getAllEvents().size());
  TimelineEvents.EventsOfOneEntity partEvents = events.getAllEvents().get(0);
  Assert.assertEquals(2, partEvents.getEvents().size());
  TimelineEvent event1 = partEvents.getEvents().get(0);
  Assert.assertEquals(456l, event1.getTimestamp());
  Assert.assertEquals("end_event", event1.getEventType());
  Assert.assertEquals(1, event1.getEventInfo().size());
  TimelineEvent event2 = partEvents.getEvents().get(1);
  Assert.assertEquals(123l, event2.getTimestamp());
  Assert.assertEquals("start_event", event2.getEventType());
  Assert.assertEquals(0, event2.getEventInfo().size());
}
 
Example #13
Source File: ApplicationMaster.java    From big-c with Apache License 2.0 6 votes vote down vote up
private static void publishContainerEndEvent(
    final TimelineClient timelineClient, ContainerStatus container,
    String domainId, UserGroupInformation ugi) {
  final TimelineEntity entity = new TimelineEntity();
  entity.setEntityId(container.getContainerId().toString());
  entity.setEntityType(DSEntity.DS_CONTAINER.toString());
  entity.setDomainId(domainId);
  entity.addPrimaryFilter("user", ugi.getShortUserName());
  TimelineEvent event = new TimelineEvent();
  event.setTimestamp(System.currentTimeMillis());
  event.setEventType(DSEvent.DS_CONTAINER_END.toString());
  event.addEventInfo("State", container.getState().name());
  event.addEventInfo("Exit Status", container.getExitStatus());
  entity.addEvent(event);
  try {
    timelineClient.putEntities(entity);
  } catch (YarnException | IOException e) {
    LOG.error("Container end event could not be published for "
        + container.getContainerId().toString(), e);
  }
}
 
Example #14
Source File: HistoryEventTimelineConversion.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertAMLaunchedEvent(AMLaunchedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId("tez_"
      + event.getApplicationAttemptId().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_APPLICATION_ATTEMPT.name());

  atsEntity.addRelatedEntity(ATSConstants.APPLICATION_ID,
      event.getApplicationAttemptId().getApplicationId().toString());
  atsEntity.addRelatedEntity(ATSConstants.APPLICATION_ATTEMPT_ID,
      event.getApplicationAttemptId().toString());
  atsEntity.addRelatedEntity(ATSConstants.USER, event.getUser());

  atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser());

  atsEntity.setStartTime(event.getLaunchTime());

  TimelineEvent launchEvt = new TimelineEvent();
  launchEvt.setEventType(HistoryEventType.AM_LAUNCHED.name());
  launchEvt.setTimestamp(event.getLaunchTime());
  atsEntity.addEvent(launchEvt);

  atsEntity.addOtherInfo(ATSConstants.APP_SUBMIT_TIME, event.getAppSubmitTime());

  return atsEntity;
}
 
Example #15
Source File: HistoryEventTimelineConversion.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertContainerLaunchedEvent(ContainerLaunchedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId("tez_"
      + event.getContainerId().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_CONTAINER_ID.name());

  atsEntity.addRelatedEntity(EntityTypes.TEZ_APPLICATION_ATTEMPT.name(),
      "tez_" + event.getApplicationAttemptId().toString());
  atsEntity.addRelatedEntity(ATSConstants.CONTAINER_ID,
      event.getContainerId().toString());

  atsEntity.setStartTime(event.getLaunchTime());

  TimelineEvent launchEvt = new TimelineEvent();
  launchEvt.setEventType(HistoryEventType.CONTAINER_LAUNCHED.name());
  launchEvt.setTimestamp(event.getLaunchTime());
  atsEntity.addEvent(launchEvt);

  return atsEntity;
}
 
Example #16
Source File: SystemMetricsPublisher.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void publishApplicationCreatedEvent(ApplicationCreatedEvent event) {
  TimelineEntity entity =
      createApplicationEntity(event.getApplicationId());
  Map<String, Object> entityInfo = new HashMap<String, Object>();
  entityInfo.put(ApplicationMetricsConstants.NAME_ENTITY_INFO,
      event.getApplicationName());
  entityInfo.put(ApplicationMetricsConstants.TYPE_ENTITY_INFO,
      event.getApplicationType());
  entityInfo.put(ApplicationMetricsConstants.USER_ENTITY_INFO,
      event.getUser());
  entityInfo.put(ApplicationMetricsConstants.QUEUE_ENTITY_INFO,
      event.getQueue());
  entityInfo.put(ApplicationMetricsConstants.SUBMITTED_TIME_ENTITY_INFO,
      event.getSubmittedTime());
  entity.setOtherInfo(entityInfo);
  TimelineEvent tEvent = new TimelineEvent();
  tEvent.setEventType(
      ApplicationMetricsConstants.CREATED_EVENT_TYPE);
  tEvent.setTimestamp(event.getTimestamp());
  entity.addEvent(tEvent);
  putEntity(entity);
}
 
Example #17
Source File: HistoryEventTimelineConversion.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertDAGFinishedEvent(DAGFinishedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getDagID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_DAG_ID.name());

  TimelineEvent finishEvt = new TimelineEvent();
  finishEvt.setEventType(HistoryEventType.DAG_FINISHED.name());
  finishEvt.setTimestamp(event.getFinishTime());
  atsEntity.addEvent(finishEvt);

  atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser());
  atsEntity.addPrimaryFilter(ATSConstants.DAG_NAME, event.getDagName());

  atsEntity.addOtherInfo(ATSConstants.START_TIME, event.getStartTime());
  atsEntity.addOtherInfo(ATSConstants.FINISH_TIME, event.getFinishTime());
  atsEntity.addOtherInfo(ATSConstants.TIME_TAKEN, (event.getFinishTime() - event.getStartTime()));
  atsEntity.addOtherInfo(ATSConstants.STATUS, event.getState().name());
  atsEntity.addOtherInfo(ATSConstants.DIAGNOSTICS, event.getDiagnostics());
  atsEntity.addOtherInfo(ATSConstants.COUNTERS,
      DAGUtils.convertCountersToATSMap(event.getTezCounters()));

  return atsEntity;
}
 
Example #18
Source File: HistoryEventTimelineConversion.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertDAGInitializedEvent(DAGInitializedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getDagID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_DAG_ID.name());

  TimelineEvent finishEvt = new TimelineEvent();
  finishEvt.setEventType(HistoryEventType.DAG_INITIALIZED.name());
  finishEvt.setTimestamp(event.getInitTime());
  atsEntity.addEvent(finishEvt);

  atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser());
  atsEntity.addPrimaryFilter(ATSConstants.DAG_NAME, event.getDagName());

  atsEntity.addOtherInfo(ATSConstants.INIT_TIME, event.getInitTime());

  return atsEntity;
}
 
Example #19
Source File: HistoryEventTimelineConversion.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertDAGStartedEvent(DAGStartedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getDagID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_DAG_ID.name());

  TimelineEvent startEvt = new TimelineEvent();
  startEvt.setEventType(HistoryEventType.DAG_STARTED.name());
  startEvt.setTimestamp(event.getStartTime());
  atsEntity.addEvent(startEvt);

  atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser());
  atsEntity.addPrimaryFilter(ATSConstants.DAG_NAME, event.getDagName());

  atsEntity.addOtherInfo(ATSConstants.START_TIME, event.getStartTime());

  return atsEntity;
}
 
Example #20
Source File: HistoryEventTimelineConversion.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertTaskAttemptFinishedEvent(TaskAttemptFinishedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getTaskAttemptID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_TASK_ATTEMPT_ID.name());

  atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(),
      event.getTaskAttemptID().getTaskID().getVertexID().getDAGId().toString());
  atsEntity.addPrimaryFilter(EntityTypes.TEZ_VERTEX_ID.name(),
      event.getTaskAttemptID().getTaskID().getVertexID().toString());
  atsEntity.addPrimaryFilter(EntityTypes.TEZ_TASK_ID.name(),
      event.getTaskAttemptID().getTaskID().toString());

  TimelineEvent finishEvt = new TimelineEvent();
  finishEvt.setEventType(HistoryEventType.TASK_ATTEMPT_FINISHED.name());
  finishEvt.setTimestamp(event.getFinishTime());
  atsEntity.addEvent(finishEvt);

  atsEntity.addOtherInfo(ATSConstants.FINISH_TIME, event.getFinishTime());
  atsEntity.addOtherInfo(ATSConstants.TIME_TAKEN, (event.getFinishTime() - event.getStartTime()));
  atsEntity.addOtherInfo(ATSConstants.STATUS, event.getState().name());
  atsEntity.addOtherInfo(ATSConstants.DIAGNOSTICS, event.getDiagnostics());
  atsEntity.addOtherInfo(ATSConstants.COUNTERS,
      DAGUtils.convertCountersToATSMap(event.getCounters()));

  return atsEntity;
}
 
Example #21
Source File: HistoryEventTimelineConversion.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertTaskFinishedEvent(TaskFinishedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getTaskID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_TASK_ID.name());

  atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(),
      event.getTaskID().getVertexID().getDAGId().toString());
  atsEntity.addPrimaryFilter(EntityTypes.TEZ_VERTEX_ID.name(),
      event.getTaskID().getVertexID().toString());

  TimelineEvent finishEvt = new TimelineEvent();
  finishEvt.setEventType(HistoryEventType.TASK_FINISHED.name());
  finishEvt.setTimestamp(event.getFinishTime());
  atsEntity.addEvent(finishEvt);

  atsEntity.addOtherInfo(ATSConstants.FINISH_TIME, event.getFinishTime());
  atsEntity.addOtherInfo(ATSConstants.TIME_TAKEN, (event.getFinishTime() - event.getStartTime()));
  atsEntity.addOtherInfo(ATSConstants.STATUS, event.getState().name());

  atsEntity.addOtherInfo(ATSConstants.DIAGNOSTICS, event.getDiagnostics());
  atsEntity.addOtherInfo(ATSConstants.COUNTERS,
      DAGUtils.convertCountersToATSMap(event.getTezCounters()));

  return atsEntity;
}
 
Example #22
Source File: HistoryEventTimelineConversion.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertTaskStartedEvent(TaskStartedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getTaskID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_TASK_ID.name());

  atsEntity.addRelatedEntity(EntityTypes.TEZ_VERTEX_ID.name(),
      event.getTaskID().getVertexID().toString());
  atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(),
      event.getTaskID().getVertexID().getDAGId().toString());
  atsEntity.addPrimaryFilter(EntityTypes.TEZ_VERTEX_ID.name(),
      event.getTaskID().getVertexID().toString());

  TimelineEvent startEvt = new TimelineEvent();
  startEvt.setEventType(HistoryEventType.TASK_STARTED.name());
  startEvt.setTimestamp(event.getStartTime());
  atsEntity.addEvent(startEvt);

  atsEntity.addOtherInfo(ATSConstants.START_TIME, event.getStartTime());
  atsEntity.addOtherInfo(ATSConstants.SCHEDULED_TIME, event.getScheduledTime());

  return atsEntity;
}
 
Example #23
Source File: HistoryEventTimelineConversion.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertVertexFinishedEvent(VertexFinishedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getVertexID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_VERTEX_ID.name());

  atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(),
      event.getVertexID().getDAGId().toString());

  TimelineEvent finishEvt = new TimelineEvent();
  finishEvt.setEventType(HistoryEventType.VERTEX_FINISHED.name());
  finishEvt.setTimestamp(event.getFinishTime());
  atsEntity.addEvent(finishEvt);

  atsEntity.addOtherInfo(ATSConstants.FINISH_TIME, event.getFinishTime());
  atsEntity.addOtherInfo(ATSConstants.TIME_TAKEN, (event.getFinishTime() - event.getStartTime()));
  atsEntity.addOtherInfo(ATSConstants.STATUS, event.getState().name());

  atsEntity.addOtherInfo(ATSConstants.DIAGNOSTICS, event.getDiagnostics());
  atsEntity.addOtherInfo(ATSConstants.COUNTERS,
      DAGUtils.convertCountersToATSMap(event.getTezCounters()));
  atsEntity.addOtherInfo(ATSConstants.STATS,
      DAGUtils.convertVertexStatsToATSMap(event.getVertexStats()));

  return atsEntity;
}
 
Example #24
Source File: HistoryEventTimelineConversion.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertVertexStartedEvent(VertexStartedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getVertexID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_VERTEX_ID.name());

  atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(),
      event.getVertexID().getDAGId().toString());

  TimelineEvent startEvt = new TimelineEvent();
  startEvt.setEventType(HistoryEventType.VERTEX_STARTED.name());
  startEvt.setTimestamp(event.getStartTime());
  atsEntity.addEvent(startEvt);

  atsEntity.addOtherInfo(ATSConstants.START_REQUESTED_TIME, event.getStartRequestedTime());
  atsEntity.addOtherInfo(ATSConstants.START_TIME, event.getStartTime());

  return atsEntity;
}
 
Example #25
Source File: HistoryEventTimelineConversion.java    From tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertAMLaunchedEvent(AMLaunchedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId("tez_"
      + event.getApplicationAttemptId().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_APPLICATION_ATTEMPT.name());

  atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser());
  atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID,
      event.getApplicationAttemptId().getApplicationId().toString());

  atsEntity.setStartTime(event.getLaunchTime());

  TimelineEvent launchEvt = new TimelineEvent();
  launchEvt.setEventType(HistoryEventType.AM_LAUNCHED.name());
  launchEvt.setTimestamp(event.getLaunchTime());
  atsEntity.addEvent(launchEvt);

  atsEntity.addOtherInfo(ATSConstants.APP_SUBMIT_TIME, event.getAppSubmitTime());
  atsEntity.addOtherInfo(ATSConstants.APPLICATION_ID,
      event.getApplicationAttemptId().getApplicationId().toString());
  atsEntity.addOtherInfo(ATSConstants.APPLICATION_ATTEMPT_ID,
      event.getApplicationAttemptId().toString());
  atsEntity.addOtherInfo(ATSConstants.USER, event.getUser());

  return atsEntity;
}
 
Example #26
Source File: HistoryEventTimelineConversion.java    From tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertAMStartedEvent(AMStartedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId("tez_"
      + event.getApplicationAttemptId().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_APPLICATION_ATTEMPT.name());

  atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser());
  atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID,
      event.getApplicationAttemptId().getApplicationId().toString());

  TimelineEvent startEvt = new TimelineEvent();
  startEvt.setEventType(HistoryEventType.AM_STARTED.name());
  startEvt.setTimestamp(event.getStartTime());
  atsEntity.addEvent(startEvt);

  return atsEntity;
}
 
Example #27
Source File: HistoryEventTimelineConversion.java    From tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertDAGFinishedToDAGExtraInfoEntity(DAGFinishedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getDagID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_DAG_EXTRA_INFO.name());

  atsEntity.addRelatedEntity(EntityTypes.TEZ_DAG_ID.name(), event.getDagID().toString());

  TimelineEvent submitEvt = new TimelineEvent();
  submitEvt.setEventType(HistoryEventType.DAG_FINISHED.name());
  submitEvt.setTimestamp(event.getFinishTime());
  atsEntity.addEvent(submitEvt);

  atsEntity.addOtherInfo(ATSConstants.COUNTERS,
      DAGUtils.convertCountersToATSMap(event.getTezCounters()));
  return atsEntity;
}
 
Example #28
Source File: HistoryEventTimelineConversion.java    From tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertDAGStartedEvent(DAGStartedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getDagID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_DAG_ID.name());

  TimelineEvent startEvt = new TimelineEvent();
  startEvt.setEventType(HistoryEventType.DAG_STARTED.name());
  startEvt.setTimestamp(event.getStartTime());
  atsEntity.addEvent(startEvt);

  atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser());
  atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID,
      event.getDagID().getApplicationId().toString());
  atsEntity.addPrimaryFilter(ATSConstants.DAG_NAME, event.getDagName());

  atsEntity.addOtherInfo(ATSConstants.START_TIME, event.getStartTime());
  atsEntity.addOtherInfo(ATSConstants.STATUS, event.getDagState().toString());

  return atsEntity;
}
 
Example #29
Source File: HistoryEventTimelineConversion.java    From tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertDAGSubmittedToDAGExtraInfoEntity(DAGSubmittedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getDagID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_DAG_EXTRA_INFO.name());

  atsEntity.addRelatedEntity(EntityTypes.TEZ_DAG_ID.name(), event.getDagID().toString());

  TimelineEvent submitEvt = new TimelineEvent();
  submitEvt.setEventType(HistoryEventType.DAG_SUBMITTED.name());
  submitEvt.setTimestamp(event.getSubmitTime());
  atsEntity.addEvent(submitEvt);

  atsEntity.setStartTime(event.getSubmitTime());

  try {
    atsEntity.addOtherInfo(ATSConstants.DAG_PLAN,
        DAGUtils.convertDAGPlanToATSMap(event.getDAGPlan()));
  } catch (IOException e) {
    throw new TezUncheckedException(e);
  }
  return atsEntity;
}
 
Example #30
Source File: HistoryEventTimelineConversion.java    From tez with Apache License 2.0 6 votes vote down vote up
private static TimelineEntity convertVertexStartedEvent(VertexStartedEvent event) {
  TimelineEntity atsEntity = new TimelineEntity();
  atsEntity.setEntityId(event.getVertexID().toString());
  atsEntity.setEntityType(EntityTypes.TEZ_VERTEX_ID.name());

  atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID,
      event.getVertexID().getDAGId().getApplicationId().toString());
  atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(),
      event.getVertexID().getDAGId().toString());

  TimelineEvent startEvt = new TimelineEvent();
  startEvt.setEventType(HistoryEventType.VERTEX_STARTED.name());
  startEvt.setTimestamp(event.getStartTime());
  atsEntity.addEvent(startEvt);

  atsEntity.addOtherInfo(ATSConstants.START_REQUESTED_TIME, event.getStartRequestedTime());
  atsEntity.addOtherInfo(ATSConstants.START_TIME, event.getStartTime());
  atsEntity.addOtherInfo(ATSConstants.STATUS, event.getVertexState().toString());

  return atsEntity;
}