@VisibleForTesting void appendDiagnostics(final CharSequence message) { this.diagnostics.append(message); }
@Override public void transition(RMAppAttemptImpl appAttempt, RMAppAttemptEvent event) { appAttempt.diagnostics.append(getAMExpiredDiagnostics(event)); super.transition(appAttempt, event); } }
@Override public void transition(RMAppAttemptImpl appAttempt, RMAppAttemptEvent event) { assert appAttempt.submissionContext.getUnmanagedAM(); appAttempt.diagnostics.append(getUnexpectedAMRegisteredDiagnostics()); super.transition(appAttempt, event); }
@Override public void transition(RMAppAttemptImpl appAttempt, RMAppAttemptEvent event) { // Use diagnostic from launcher appAttempt.diagnostics.append(event.getDiagnosticMsg()); // Tell the app, scheduler super.transition(appAttempt, event); } }
private void setAMContainerCrashedDiagnosticsAndExitStatus( RMAppAttemptContainerFinishedEvent finishEvent) { ContainerStatus status = finishEvent.getContainerStatus(); this.diagnostics.append(getAMContainerCrashedDiagnostics(finishEvent)); this.amContainerExitStatus = status.getExitStatus(); }
@Test public void appendValuesBelowLimitAreReadCorrectlyInFifoOrder() { final BoundedAppender boundedAppender = new BoundedAppender(3); boundedAppender.append("ab"); boundedAppender.append("cd"); boundedAppender.append("e"); boundedAppender.append("fg"); assertEquals("last values appended fitting limit are read correctly", String.format(BoundedAppender.TRUNCATED_MESSAGES_TEMPLATE, 3, 7, "efg"), boundedAppender.toString()); }
@Override public void transition(RMAppAttemptImpl appAttempt, RMAppAttemptEvent event) { if (event.getDiagnosticMsg() != null) { appAttempt.diagnostics.append(event.getDiagnosticMsg()); } super.transition(appAttempt, event); } }
@Test public void appendLastAboveLimitPreservesLastMessagePostfix() { final BoundedAppender boundedAppender = new BoundedAppender(3); boundedAppender.append("ab"); boundedAppender.append("cde"); boundedAppender.append("fghij"); assertEquals( "last value appended above limit postfix is read correctly", String .format(BoundedAppender.TRUNCATED_MESSAGES_TEMPLATE, 3, 10, "hij"), boundedAppender.toString()); }
private void updateInfoOnAMUnregister(RMAppAttemptEvent event) { progress = 1.0f; RMAppAttemptUnregistrationEvent unregisterEvent = (RMAppAttemptUnregistrationEvent) event; this.diagnostics.append(unregisterEvent.getDiagnosticMsg()); originalTrackingUrl = sanitizeTrackingUrl(unregisterEvent.getFinalTrackingUrl()); finalStatus = unregisterEvent.getFinalApplicationStatus(); }
@Test public void appendMiddleAboveLimitPreservesLastMessageAndMiddlePostfix() { final BoundedAppender boundedAppender = new BoundedAppender(3); boundedAppender.append("ab"); boundedAppender.append("cde"); assertEquals("last value appended above limit postfix is read correctly", String.format(BoundedAppender.TRUNCATED_MESSAGES_TEMPLATE, 3, 5, "cde"), boundedAppender.toString()); boundedAppender.append("fg"); assertEquals( "middle value appended above limit postfix and last value are " + "read correctly", String.format(BoundedAppender.TRUNCATED_MESSAGES_TEMPLATE, 3, 7, "efg"), boundedAppender.toString()); boundedAppender.append("hijkl"); assertEquals( "last value appended above limit postfix is read correctly", String .format(BoundedAppender.TRUNCATED_MESSAGES_TEMPLATE, 3, 12, "jkl"), boundedAppender.toString()); } }
if (containerStatus.getExitStatus() != 0) { LOG.error(message); diagnostics.append(containerStatus.getDiagnostics()); } else { LOG.info(message);
switch (event.getType()) { case LAUNCH_FAILED: diags.append(event.getDiagnosticMsg()); break; case REGISTERED: diags.append(getUnexpectedAMRegisteredDiagnostics()); break; case UNREGISTERED: RMAppAttemptUnregistrationEvent unregisterEvent = (RMAppAttemptUnregistrationEvent) event; diags.append(unregisterEvent.getDiagnosticMsg()); RMAppAttemptContainerFinishedEvent finishEvent = (RMAppAttemptContainerFinishedEvent) event; diags.append(getAMContainerCrashedDiagnostics(finishEvent)); exitStatus = finishEvent.getContainerStatus().getExitStatus(); break; break; case FAIL: diags.append(event.getDiagnosticMsg()); break; case EXPIRE: diags.append(getAMExpiredDiagnostics(event)); break; default:
@Test public void nullAppendedNullStringRead() { final BoundedAppender boundedAppender = new BoundedAppender(4); boundedAppender.append(null); assertEquals("null appended, \"null\" read", "null", boundedAppender.toString()); }
@Test public void appendBelowLimitOnceValueIsReadCorrectly() { final BoundedAppender boundedAppender = new BoundedAppender(2); boundedAppender.append("ab"); assertEquals("value appended is read correctly", "ab", boundedAppender.toString()); }