@Test public void testHandlerExists() throws JSONException { for (HistoryEventType eventType : HistoryEventType.values()) { HistoryEvent event = null; switch (eventType) { case AM_LAUNCHED: event = new AMLaunchedEvent(applicationAttemptId, random.nextInt(), random.nextInt(), user); break; case AM_STARTED: event = new AMStartedEvent(applicationAttemptId, random.nextInt(), user); break; case DAG_SUBMITTED: event = new DAGSubmittedEvent(tezDAGID, random.nextInt(), dagPlan, applicationAttemptId, null, user); break; case DAG_INITIALIZED: event = new DAGInitializedEvent(tezDAGID, random.nextInt(), user, dagPlan.getName()); break; case DAG_STARTED: event = new DAGStartedEvent(tezDAGID, random.nextInt(), user, dagPlan.getName()); break; case DAG_FINISHED: event = new DAGFinishedEvent(tezDAGID, random.nextInt(), random.nextInt(), DAGState.ERROR, null, null, user, dagPlan.getName()); break; case VERTEX_INITIALIZED: event = new VertexInitializedEvent(tezVertexID, "v1", random.nextInt(), random.nextInt(), random.nextInt(), "proc", null); break; case VERTEX_STARTED: event = new VertexStartedEvent(tezVertexID, random.nextInt(), random.nextInt()); break; case VERTEX_PARALLELISM_UPDATED: event = new VertexParallelismUpdatedEvent(); break; case VERTEX_FINISHED: event = new VertexFinishedEvent(tezVertexID, "v1", random.nextInt(), random.nextInt(), random.nextInt(), random.nextInt(), random.nextInt(), VertexState.ERROR, null, null, null); break; case TASK_STARTED: event = new TaskStartedEvent(tezTaskID, "v1", random.nextInt(), random.nextInt()); break; case TASK_FINISHED: event = new TaskFinishedEvent(tezTaskID, "v1", random.nextInt(), random.nextInt(), tezTaskAttemptID, TaskState.FAILED, null, null); break; case TASK_ATTEMPT_STARTED: event = new TaskAttemptStartedEvent(tezTaskAttemptID, "v1", random.nextInt(), containerId, nodeId, null, null); break; case TASK_ATTEMPT_FINISHED: event = new TaskAttemptFinishedEvent(tezTaskAttemptID, "v1", random.nextInt(), random.nextInt(), TaskAttemptState.FAILED, null, null); break; case CONTAINER_LAUNCHED: event = new ContainerLaunchedEvent(containerId, random.nextInt(), applicationAttemptId); break; case CONTAINER_STOPPED: event = new ContainerStoppedEvent(containerId, random.nextInt(), -1, applicationAttemptId); break; case VERTEX_DATA_MOVEMENT_EVENTS_GENERATED: event = new VertexDataMovementEventsGeneratedEvent(); break; case DAG_COMMIT_STARTED: event = new DAGCommitStartedEvent(); break; case VERTEX_COMMIT_STARTED: event = new VertexCommitStartedEvent(); break; case VERTEX_GROUP_COMMIT_STARTED: event = new VertexGroupCommitStartedEvent(); break; case VERTEX_GROUP_COMMIT_FINISHED: event = new VertexGroupCommitFinishedEvent(); break; default: Assert.fail("Unhandled event type " + eventType); } if (event == null || !event.isHistoryEvent()) { continue; } HistoryEventTimelineConversion.convertToTimelineEntity(event); } }
public static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent) { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } TimelineEntity timelineEntity = null; switch (historyEvent.getEventType()) { case AM_LAUNCHED: timelineEntity = convertAMLaunchedEvent((AMLaunchedEvent) historyEvent); break; case AM_STARTED: timelineEntity = convertAMStartedEvent((AMStartedEvent) historyEvent); break; case CONTAINER_LAUNCHED: timelineEntity = convertContainerLaunchedEvent((ContainerLaunchedEvent) historyEvent); break; case CONTAINER_STOPPED: timelineEntity = convertContainerStoppedEvent((ContainerStoppedEvent) historyEvent); break; case DAG_SUBMITTED: timelineEntity = convertDAGSubmittedEvent((DAGSubmittedEvent) historyEvent); break; case DAG_INITIALIZED: timelineEntity = convertDAGInitializedEvent((DAGInitializedEvent) historyEvent); break; case DAG_STARTED: timelineEntity = convertDAGStartedEvent((DAGStartedEvent) historyEvent); break; case DAG_FINISHED: timelineEntity = convertDAGFinishedEvent((DAGFinishedEvent) historyEvent); break; case VERTEX_INITIALIZED: timelineEntity = convertVertexInitializedEvent((VertexInitializedEvent) historyEvent); break; case VERTEX_STARTED: timelineEntity = convertVertexStartedEvent((VertexStartedEvent) historyEvent); break; case VERTEX_FINISHED: timelineEntity = convertVertexFinishedEvent((VertexFinishedEvent) historyEvent); break; case TASK_STARTED: timelineEntity = convertTaskStartedEvent((TaskStartedEvent) historyEvent); break; case TASK_FINISHED: timelineEntity = convertTaskFinishedEvent((TaskFinishedEvent) historyEvent); break; case TASK_ATTEMPT_STARTED: timelineEntity = convertTaskAttemptStartedEvent((TaskAttemptStartedEvent) historyEvent); break; case TASK_ATTEMPT_FINISHED: timelineEntity = convertTaskAttemptFinishedEvent((TaskAttemptFinishedEvent) historyEvent); break; case VERTEX_DATA_MOVEMENT_EVENTS_GENERATED: case VERTEX_COMMIT_STARTED: case VERTEX_GROUP_COMMIT_STARTED: case VERTEX_GROUP_COMMIT_FINISHED: case VERTEX_PARALLELISM_UPDATED: case DAG_COMMIT_STARTED: throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); default: throw new UnsupportedOperationException("Unhandled Event" + ", eventType=" + historyEvent.getEventType()); } return timelineEntity; }
HistoryEventTimelineConversion { public static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent) { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } TimelineEntity timelineEntity = null; switch (historyEvent.getEventType()) { case AM_LAUNCHED: timelineEntity = convertAMLaunchedEvent((AMLaunchedEvent) historyEvent); break; case AM_STARTED: timelineEntity = convertAMStartedEvent((AMStartedEvent) historyEvent); break; case CONTAINER_LAUNCHED: timelineEntity = convertContainerLaunchedEvent((ContainerLaunchedEvent) historyEvent); break; case CONTAINER_STOPPED: timelineEntity = convertContainerStoppedEvent((ContainerStoppedEvent) historyEvent); break; case DAG_SUBMITTED: timelineEntity = convertDAGSubmittedEvent((DAGSubmittedEvent) historyEvent); break; case DAG_INITIALIZED: timelineEntity = convertDAGInitializedEvent((DAGInitializedEvent) historyEvent); break; case DAG_STARTED: timelineEntity = convertDAGStartedEvent((DAGStartedEvent) historyEvent); break; case DAG_FINISHED: timelineEntity = convertDAGFinishedEvent((DAGFinishedEvent) historyEvent); break; case VERTEX_INITIALIZED: timelineEntity = convertVertexInitializedEvent((VertexInitializedEvent) historyEvent); break; case VERTEX_STARTED: timelineEntity = convertVertexStartedEvent((VertexStartedEvent) historyEvent); break; case VERTEX_FINISHED: timelineEntity = convertVertexFinishedEvent((VertexFinishedEvent) historyEvent); break; case TASK_STARTED: timelineEntity = convertTaskStartedEvent((TaskStartedEvent) historyEvent); break; case TASK_FINISHED: timelineEntity = convertTaskFinishedEvent((TaskFinishedEvent) historyEvent); break; case TASK_ATTEMPT_STARTED: timelineEntity = convertTaskAttemptStartedEvent((TaskAttemptStartedEvent) historyEvent); break; case TASK_ATTEMPT_FINISHED: timelineEntity = convertTaskAttemptFinishedEvent((TaskAttemptFinishedEvent) historyEvent); break; case VERTEX_DATA_MOVEMENT_EVENTS_GENERATED: case VERTEX_COMMIT_STARTED: case VERTEX_GROUP_COMMIT_STARTED: case VERTEX_GROUP_COMMIT_FINISHED: case VERTEX_PARALLELISM_UPDATED: case DAG_COMMIT_STARTED: throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); default: throw new UnsupportedOperationException("Unhandled Event" + ", eventType=" + historyEvent.getEventType()); } return timelineEntity; } }
HistoryEventTimelineConversion { public static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent) { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } TimelineEntity timelineEntity = null; switch (historyEvent.getEventType()) { case AM_LAUNCHED: timelineEntity = convertAMLaunchedEvent((AMLaunchedEvent) historyEvent); break; case AM_STARTED: timelineEntity = convertAMStartedEvent((AMStartedEvent) historyEvent); break; case CONTAINER_LAUNCHED: timelineEntity = convertContainerLaunchedEvent((ContainerLaunchedEvent) historyEvent); break; case CONTAINER_STOPPED: timelineEntity = convertContainerStoppedEvent((ContainerStoppedEvent) historyEvent); break; case DAG_SUBMITTED: timelineEntity = convertDAGSubmittedEvent((DAGSubmittedEvent) historyEvent); break; case DAG_INITIALIZED: timelineEntity = convertDAGInitializedEvent((DAGInitializedEvent) historyEvent); break; case DAG_STARTED: timelineEntity = convertDAGStartedEvent((DAGStartedEvent) historyEvent); break; case DAG_FINISHED: timelineEntity = convertDAGFinishedEvent((DAGFinishedEvent) historyEvent); break; case VERTEX_INITIALIZED: timelineEntity = convertVertexInitializedEvent((VertexInitializedEvent) historyEvent); break; case VERTEX_STARTED: timelineEntity = convertVertexStartedEvent((VertexStartedEvent) historyEvent); break; case VERTEX_FINISHED: timelineEntity = convertVertexFinishedEvent((VertexFinishedEvent) historyEvent); break; case TASK_STARTED: timelineEntity = convertTaskStartedEvent((TaskStartedEvent) historyEvent); break; case TASK_FINISHED: timelineEntity = convertTaskFinishedEvent((TaskFinishedEvent) historyEvent); break; case TASK_ATTEMPT_STARTED: timelineEntity = convertTaskAttemptStartedEvent((TaskAttemptStartedEvent) historyEvent); break; case TASK_ATTEMPT_FINISHED: timelineEntity = convertTaskAttemptFinishedEvent((TaskAttemptFinishedEvent) historyEvent); break; case VERTEX_DATA_MOVEMENT_EVENTS_GENERATED: case VERTEX_COMMIT_STARTED: case VERTEX_GROUP_COMMIT_STARTED: case VERTEX_GROUP_COMMIT_FINISHED: case VERTEX_PARALLELISM_UPDATED: case DAG_COMMIT_STARTED: throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); default: throw new UnsupportedOperationException("Unhandled Event" + ", eventType=" + historyEvent.getEventType()); } return timelineEntity; }  }
HistoryEventTimelineConversion { public static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent) { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } TimelineEntity timelineEntity = null; switch (historyEvent.getEventType()) { case AM_LAUNCHED: timelineEntity = convertAMLaunchedEvent((AMLaunchedEvent) historyEvent); break; case AM_STARTED: timelineEntity = convertAMStartedEvent((AMStartedEvent) historyEvent); break; case CONTAINER_LAUNCHED: timelineEntity = convertContainerLaunchedEvent((ContainerLaunchedEvent) historyEvent); break; case CONTAINER_STOPPED: timelineEntity = convertContainerStoppedEvent((ContainerStoppedEvent) historyEvent); break; case DAG_SUBMITTED: timelineEntity = convertDAGSubmittedEvent((DAGSubmittedEvent) historyEvent); break; case DAG_INITIALIZED: timelineEntity = convertDAGInitializedEvent((DAGInitializedEvent) historyEvent); break; case DAG_STARTED: timelineEntity = convertDAGStartedEvent((DAGStartedEvent) historyEvent); break; case DAG_FINISHED: timelineEntity = convertDAGFinishedEvent((DAGFinishedEvent) historyEvent); break; case VERTEX_INITIALIZED: timelineEntity = convertVertexInitializedEvent((VertexInitializedEvent) historyEvent); break; case VERTEX_STARTED: timelineEntity = convertVertexStartedEvent((VertexStartedEvent) historyEvent); break; case VERTEX_FINISHED: timelineEntity = convertVertexFinishedEvent((VertexFinishedEvent) historyEvent); break; case TASK_STARTED: timelineEntity = convertTaskStartedEvent((TaskStartedEvent) historyEvent); break; case TASK_FINISHED: timelineEntity = convertTaskFinishedEvent((TaskFinishedEvent) historyEvent); break; case TASK_ATTEMPT_STARTED: timelineEntity = convertTaskAttemptStartedEvent((TaskAttemptStartedEvent) historyEvent); break; case TASK_ATTEMPT_FINISHED: timelineEntity = convertTaskAttemptFinishedEvent((TaskAttemptFinishedEvent) historyEvent); break; case VERTEX_DATA_MOVEMENT_EVENTS_GENERATED: case VERTEX_COMMIT_STARTED: case VERTEX_GROUP_COMMIT_STARTED: case VERTEX_GROUP_COMMIT_FINISHED: case VERTEX_PARALLELISM_UPDATED: case DAG_COMMIT_STARTED: throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); default: throw new UnsupportedOperationException("Unhandled Event" + ", eventType=" + historyEvent.getEventType()); } return timelineEntity; }  static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent); }
HistoryEventTimelineConversion { public static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent) { if (!historyEvent.isHistoryEvent()) { throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); } TimelineEntity timelineEntity = null; switch (historyEvent.getEventType()) { case AM_LAUNCHED: timelineEntity = convertAMLaunchedEvent((AMLaunchedEvent) historyEvent); break; case AM_STARTED: timelineEntity = convertAMStartedEvent((AMStartedEvent) historyEvent); break; case CONTAINER_LAUNCHED: timelineEntity = convertContainerLaunchedEvent((ContainerLaunchedEvent) historyEvent); break; case CONTAINER_STOPPED: timelineEntity = convertContainerStoppedEvent((ContainerStoppedEvent) historyEvent); break; case DAG_SUBMITTED: timelineEntity = convertDAGSubmittedEvent((DAGSubmittedEvent) historyEvent); break; case DAG_INITIALIZED: timelineEntity = convertDAGInitializedEvent((DAGInitializedEvent) historyEvent); break; case DAG_STARTED: timelineEntity = convertDAGStartedEvent((DAGStartedEvent) historyEvent); break; case DAG_FINISHED: timelineEntity = convertDAGFinishedEvent((DAGFinishedEvent) historyEvent); break; case VERTEX_INITIALIZED: timelineEntity = convertVertexInitializedEvent((VertexInitializedEvent) historyEvent); break; case VERTEX_STARTED: timelineEntity = convertVertexStartedEvent((VertexStartedEvent) historyEvent); break; case VERTEX_FINISHED: timelineEntity = convertVertexFinishedEvent((VertexFinishedEvent) historyEvent); break; case TASK_STARTED: timelineEntity = convertTaskStartedEvent((TaskStartedEvent) historyEvent); break; case TASK_FINISHED: timelineEntity = convertTaskFinishedEvent((TaskFinishedEvent) historyEvent); break; case TASK_ATTEMPT_STARTED: timelineEntity = convertTaskAttemptStartedEvent((TaskAttemptStartedEvent) historyEvent); break; case TASK_ATTEMPT_FINISHED: timelineEntity = convertTaskAttemptFinishedEvent((TaskAttemptFinishedEvent) historyEvent); break; case VERTEX_DATA_MOVEMENT_EVENTS_GENERATED: case VERTEX_COMMIT_STARTED: case VERTEX_GROUP_COMMIT_STARTED: case VERTEX_GROUP_COMMIT_FINISHED: case VERTEX_PARALLELISM_UPDATED: case DAG_COMMIT_STARTED: throw new UnsupportedOperationException("Invalid Event, does not support history" + ", eventType=" + historyEvent.getEventType()); default: throw new UnsupportedOperationException("Unhandled Event" + ", eventType=" + historyEvent.getEventType()); } return timelineEntity; }  static TimelineEntity convertToTimelineEntity(HistoryEvent historyEvent);  }