/** * Can this parser parse the input? * * @param input * @return Whether this parser can parse the input. * @throws IOException */ public static boolean canParse(InputStream input) throws IOException { final DataInputStream in = new ForkedDataInputStream(input); try { final EventReader reader = new EventReader(in); try { reader.getNextEvent(); } catch (IOException e) { return false; } finally { reader.close(); } } catch (IOException e) { return false; } return true; }
/** Get the Map counters for the job */ public Counters getMapCounters() { return EventReader.fromAvro(datum.mapCounters); } /** Get the reduce counters for the job */
/** * Parse the entire history file and populate the JobInfo object * The first invocation will populate the object, subsequent calls * will return the already parsed object. * The input stream is closed on return * @return The populated jobInfo object * @throws IOException */ public synchronized JobInfo parse() throws IOException { if (info != null) { return info; } EventReader reader = new EventReader(in); HistoryEvent event; info = new JobInfo(); try { while ((event = reader.getNextEvent()) != null) { handleEvent(event); } } finally { in.close(); } return info; }
public CurrentJHParser(InputStream input) throws IOException { reader = new EventReader(new DataInputStream(input)); }
@Override public HistoryEvent nextEvent() throws IOException { return reader.getNextEvent(); }
@Override public void close() throws IOException { reader.close(); }
try { inputStream = getPreviousJobHistoryStream(getConfig(), appAttemptID); EventReader jobHistoryEventReader = new EventReader(inputStream); while ((event = jobHistoryEventReader.getNextEvent()) != null) { if (event.getEventType() == EventType.AM_STARTED) { if (!amStartedEventsBegan) {
public CurrentJHParser(InputStream input) throws IOException { reader = new EventReader(new DataInputStream(input)); }
@Override public HistoryEvent nextEvent() throws IOException { return reader.getNextEvent(); }
@Override public void close() throws IOException { reader.close(); }
try { inputStream = getPreviousJobHistoryStream(getConfig(), appAttemptID); EventReader jobHistoryEventReader = new EventReader(inputStream); while ((event = jobHistoryEventReader.getNextEvent()) != null) { if (event.getEventType() == EventType.AM_STARTED) { if (!amStartedEventsBegan) {
/** * Can this parser parse the input? * * @param input * @return Whether this parser can parse the input. * @throws IOException */ public static boolean canParse(InputStream input) throws IOException { final DataInputStream in = new ForkedDataInputStream(input); try { final EventReader reader = new EventReader(in); try { reader.getNextEvent(); } catch (IOException e) { return false; } finally { reader.close(); } } catch (IOException e) { return false; } return true; }
public synchronized void parse(HistoryEventHandler handler) throws IOException { parse(new EventReader(in), handler); }
/** Get the reduce counters for the job */ public Counters getReduceCounters() { return EventReader.fromAvro(datum.reduceCounters); } }
/** * Only used for unit tests. */ @Private public synchronized void parse(EventReader reader, HistoryEventHandler handler) throws IOException { int eventCtr = 0; HistoryEvent event; try { while ((event = reader.getNextEvent()) != null) { handler.handleEvent(event); ++eventCtr; } } catch (IOException ioe) { LOG.info("Caught exception parsing history file after " + eventCtr + " events", ioe); parseException = ioe; } finally { in.close(); } }
try { inputStream = getPreviousJobHistoryStream(getConfig(), appAttemptID); EventReader jobHistoryEventReader = new EventReader(inputStream); while ((event = jobHistoryEventReader.getNextEvent()) != null) { if (event.getEventType() == EventType.AM_STARTED) { if (!amStartedEventsBegan) {
EventReader reader = new EventReader(new DataInputStream( new ByteArrayInputStream(getEvents()))); HistoryEvent e = reader.getNextEvent(); assertTrue(e.getEventType().equals(EventType.JOB_PRIORITY_CHANGED)); assertEquals("ID", ((JobPriorityChange) e.getDatum()).getJobid().toString()); e = reader.getNextEvent(); assertTrue(e.getEventType().equals(EventType.JOB_STATUS_CHANGED)); assertEquals("ID", ((JobStatusChanged) e.getDatum()).getJobid().toString()); e = reader.getNextEvent(); assertTrue(e.getEventType().equals(EventType.TASK_UPDATED)); assertEquals("ID", ((TaskUpdated) e.getDatum()).getTaskid().toString()); e = reader.getNextEvent(); assertTrue(e.getEventType().equals(EventType.REDUCE_ATTEMPT_KILLED)); assertEquals(taskId, ((TaskAttemptUnsuccessfulCompletion) e.getDatum()).getTaskid().toString()); e = reader.getNextEvent(); assertTrue(e.getEventType().equals(EventType.JOB_KILLED)); assertEquals("ID", ((JobUnsuccessfulCompletion) e.getDatum()).getJobid().toString()); e = reader.getNextEvent(); assertTrue(e.getEventType().equals(EventType.REDUCE_ATTEMPT_STARTED)); assertEquals(taskId, ((TaskAttemptStarted) e.getDatum()).getTaskid().toString());
public synchronized void parse(HistoryEventHandler handler) throws IOException { parse(new EventReader(in), handler); }
/** Get the counters for the job */ public Counters getTotalCounters() { return EventReader.fromAvro(datum.totalCounters); } /** Get the Map counters for the job */
/** * Only used for unit tests. */ @Private public synchronized void parse(EventReader reader, HistoryEventHandler handler) throws IOException { int eventCtr = 0; HistoryEvent event; try { while ((event = reader.getNextEvent()) != null) { handler.handleEvent(event); ++eventCtr; } } catch (IOException ioe) { LOG.info("Caught exception parsing history file after " + eventCtr + " events", ioe); parseException = ioe; } finally { in.close(); } }