private String getAMContainerCrashedDiagnostics( RMAppAttemptContainerFinishedEvent finishEvent) { ContainerStatus status = finishEvent.getContainerStatus(); StringBuilder diagnosticsBuilder = new StringBuilder(); diagnosticsBuilder.append("AM Container for ").append( finishEvent.getApplicationAttemptId()).append( " exited with ").append(" exitCode: ").append(status.getExitStatus()). append("\n"); diagnosticsBuilder.append("Failing this attempt.").append("Diagnostics: ") .append(status.getDiagnostics()); if (this.getTrackingUrl() != null) { diagnosticsBuilder.append("For more detailed output,").append( " check the application tracking page: ").append( this.getTrackingUrl()).append( " Then click on links to logs of each attempt.\n"); } return diagnosticsBuilder.toString(); }
private static void addJustFinishedContainer(RMAppAttemptImpl appAttempt, RMAppAttemptContainerFinishedEvent containerFinishedEvent) { appAttempt.justFinishedContainers.putIfAbsent(containerFinishedEvent .getNodeId(), new ArrayList<ContainerStatus>()); appAttempt.justFinishedContainers.get(containerFinishedEvent .getNodeId()).add(containerFinishedEvent.getContainerStatus()); }
@Override public void transition(RMContainerImpl container, RMContainerEvent event) { RMContainerFinishedEvent finishedEvent = (RMContainerFinishedEvent) event; container.finishTime = System.currentTimeMillis(); container.finishedStatus = finishedEvent.getRemoteContainerStatus(); // Inform AppAttempt // container.getContainer() can return null when a RMContainer is a // reserved container updateAttemptMetrics(container); container.eventHandler.handle(new RMAppAttemptContainerFinishedEvent( container.appAttemptId, finishedEvent.getRemoteContainerStatus(), container.getAllocatedNode())); container.rmContext.getRMApplicationHistoryWriter().containerFinished( container); boolean saveNonAMContainerMetaInfo = container.rmContext.getYarnConfiguration().getBoolean( YarnConfiguration .APPLICATION_HISTORY_SAVE_NON_AM_CONTAINER_META_INFO, YarnConfiguration .DEFAULT_APPLICATION_HISTORY_SAVE_NON_AM_CONTAINER_META_INFO); if (saveNonAMContainerMetaInfo || container.isAMContainer()) { container.rmContext.getSystemMetricsPublisher().containerFinished( container, container.finishTime); } }
private void setAMContainerCrashedDiagnosticsAndExitStatus( RMAppAttemptContainerFinishedEvent finishEvent) { ContainerStatus status = finishEvent.getContainerStatus(); String diagnostics = getAMContainerCrashedDiagnostics(finishEvent); this.diagnostics.append(diagnostics); this.amContainerExitStatus = status.getExitStatus(); }
verify(appAttemptEventHandler).handle(captor.capture()); RMAppAttemptContainerFinishedEvent cfEvent = captor.getValue(); assertEquals(appAttemptId, cfEvent.getApplicationAttemptId()); assertEquals(containerStatus, cfEvent.getContainerStatus()); assertEquals(RMAppAttemptEventType.CONTAINER_FINISHED, cfEvent.getType());
@Override public void transition(RMContainerImpl container, RMContainerEvent event) { RMContainerFinishedEvent finishedEvent = (RMContainerFinishedEvent) event; container.finishTime = System.currentTimeMillis(); container.finishedStatus = finishedEvent.getRemoteContainerStatus(); // Inform AppAttempt // container.getContainer() can return null when a RMContainer is a // reserved container updateAttemptMetrics(container); container.eventHandler.handle(new RMAppAttemptContainerFinishedEvent( container.appAttemptId, finishedEvent.getRemoteContainerStatus(), container.getAllocatedNode())); container.rmContext.getRMApplicationHistoryWriter().containerFinished( container); boolean saveNonAMContainerMetaInfo = container.rmContext.getYarnConfiguration().getBoolean( YarnConfiguration .APPLICATION_HISTORY_SAVE_NON_AM_CONTAINER_META_INFO, YarnConfiguration .DEFAULT_APPLICATION_HISTORY_SAVE_NON_AM_CONTAINER_META_INFO); if (saveNonAMContainerMetaInfo || container.isAMContainer()) { container.rmContext.getSystemMetricsPublisher().containerFinished( container, container.finishTime); } }
private void setAMContainerCrashedDiagnosticsAndExitStatus( RMAppAttemptContainerFinishedEvent finishEvent) { ContainerStatus status = finishEvent.getContainerStatus(); String diagnostics = getAMContainerCrashedDiagnostics(finishEvent); this.diagnostics.append(diagnostics); this.amContainerExitStatus = status.getExitStatus(); }
verify(appAttemptEventHandler).handle(captor.capture()); RMAppAttemptContainerFinishedEvent cfEvent = captor.getValue(); assertEquals(appAttemptId, cfEvent.getApplicationAttemptId()); assertEquals(containerStatus, cfEvent.getContainerStatus()); assertEquals(RMAppAttemptEventType.CONTAINER_FINISHED, cfEvent.getType());
@Override public void transition(RMContainerImpl container, RMContainerEvent event) { RMContainerFinishedEvent finishedEvent = (RMContainerFinishedEvent) event; container.finishTime = System.currentTimeMillis(); container.finishedStatus = finishedEvent.getRemoteContainerStatus(); // Inform AppAttempt // container.getContainer() can return null when a RMContainer is a // reserved container updateAttemptMetrics(container); container.eventHandler.handle(new RMAppAttemptContainerFinishedEvent( container.appAttemptId, finishedEvent.getRemoteContainerStatus(), container.getAllocatedNode())); container.rmContext.getRMApplicationHistoryWriter().containerFinished( container); boolean saveNonAMContainerMetaInfo = shouldPublishNonAMContainerEventstoATS(container.rmContext); if (saveNonAMContainerMetaInfo || container.isAMContainer()) { container.rmContext.getSystemMetricsPublisher().containerFinished( container, container.finishTime); } }
private static void addJustFinishedContainer(RMAppAttemptImpl appAttempt, RMAppAttemptContainerFinishedEvent containerFinishedEvent) { appAttempt.justFinishedContainers.putIfAbsent(containerFinishedEvent .getNodeId(), new ArrayList<>()); appAttempt.justFinishedContainers.get(containerFinishedEvent .getNodeId()).add(containerFinishedEvent.getContainerStatus()); }
private void setAMContainerCrashedDiagnosticsAndExitStatus( RMAppAttemptContainerFinishedEvent finishEvent) { ContainerStatus status = finishEvent.getContainerStatus(); this.diagnostics.append(getAMContainerCrashedDiagnostics(finishEvent)); this.amContainerExitStatus = status.getExitStatus(); }
private String getAMContainerCrashedDiagnostics( RMAppAttemptContainerFinishedEvent finishEvent) { ContainerStatus status = finishEvent.getContainerStatus(); StringBuilder diagnosticsBuilder = new StringBuilder(); diagnosticsBuilder.append("AM Container for ").append( finishEvent.getApplicationAttemptId()).append( " exited with ").append(" exitCode: ").append(status.getExitStatus()). append("\n"); if (this.getTrackingUrl() != null) { diagnosticsBuilder.append("For more detailed output,").append( " check application tracking page:").append( this.getTrackingUrl()).append( "Then, click on links to logs of each attempt.\n"); } diagnosticsBuilder.append("Diagnostics: ").append(status.getDiagnostics()) .append("Failing this attempt"); return diagnosticsBuilder.toString(); }
new RMAppAttemptContainerFinishedEvent(appAttemptId, status, nodeId); rmContext.getDispatcher().getEventHandler().handle(evt);
private static void addJustFinishedContainer(RMAppAttemptImpl appAttempt, RMAppAttemptContainerFinishedEvent containerFinishedEvent) { appAttempt.justFinishedContainers.putIfAbsent(containerFinishedEvent .getNodeId(), new ArrayList<ContainerStatus>()); appAttempt.justFinishedContainers.get(containerFinishedEvent .getNodeId()).add(containerFinishedEvent.getContainerStatus()); }
@Override public RMAppAttemptState transition(RMAppAttemptImpl appAttempt, RMAppAttemptEvent event) { RMAppAttemptContainerFinishedEvent containerFinishedEvent = (RMAppAttemptContainerFinishedEvent) event; ContainerStatus containerStatus = containerFinishedEvent.getContainerStatus(); // Is this container the AmContainer? If the finished container is same as // the AMContainer, AppAttempt fails if (appAttempt.masterContainer != null && appAttempt.masterContainer.getId().equals( containerStatus.getContainerId())) { appAttempt.amContainerFinished(appAttempt, containerFinishedEvent); // Remember the follow up transition and save the final attempt state. appAttempt.rememberTargetTransitionsAndStoreState(event, transitionToDo, RMAppAttemptState.FAILED, RMAppAttemptState.FAILED); return RMAppAttemptState.FINAL_SAVING; } // Add all finished containers so that they can be acked to NM addJustFinishedContainer(appAttempt, containerFinishedEvent); return this.currentState; } }
private String getAMContainerCrashedDiagnostics( RMAppAttemptContainerFinishedEvent finishEvent) { ContainerStatus status = finishEvent.getContainerStatus(); StringBuilder diagnosticsBuilder = new StringBuilder(); diagnosticsBuilder.append("AM Container for ").append( finishEvent.getApplicationAttemptId()).append( " exited with ").append(" exitCode: ").append(status.getExitStatus()). append("\n"); if (this.getTrackingUrl() != null) { diagnosticsBuilder.append("For more detailed output,").append( " check application tracking page:").append( this.getTrackingUrl()).append( "Then, click on links to logs of each attempt.\n"); } diagnosticsBuilder.append("Diagnostics: ").append(status.getDiagnostics()) .append("Failing this attempt"); return diagnosticsBuilder.toString(); }
new RMAppAttemptContainerFinishedEvent(appAttemptId, status, nodeId); rmContext.getDispatcher().getEventHandler().handle(evt);
private void sendAMContainerToNM(RMAppAttemptImpl appAttempt, RMAppAttemptContainerFinishedEvent containerFinishedEvent) { NodeId nodeId = containerFinishedEvent.getNodeId(); finishedContainersSentToAM.putIfAbsent(nodeId, new ArrayList<ContainerStatus>()); appAttempt.finishedContainersSentToAM.get(nodeId).add( containerFinishedEvent.getContainerStatus()); if (!appAttempt.getSubmissionContext() .getKeepContainersAcrossApplicationAttempts()) { appAttempt.sendFinishedContainersToNM(); } }
@Override public RMAppAttemptState transition(RMAppAttemptImpl appAttempt, RMAppAttemptEvent event) { RMAppAttemptContainerFinishedEvent containerFinishedEvent = (RMAppAttemptContainerFinishedEvent) event; ContainerStatus containerStatus = containerFinishedEvent.getContainerStatus(); // Is this container the AmContainer? If the finished container is same as // the AMContainer, AppAttempt fails if (appAttempt.masterContainer != null && appAttempt.masterContainer.getId().equals( containerStatus.getContainerId())) { appAttempt.sendAMContainerToNM(appAttempt, containerFinishedEvent); // Remember the follow up transition and save the final attempt state. appAttempt.rememberTargetTransitionsAndStoreState(event, transitionToDo, RMAppAttemptState.FAILED, RMAppAttemptState.FAILED); return RMAppAttemptState.FINAL_SAVING; } // Add all finished containers so that they can be acked to NM addJustFinishedContainer(appAttempt, containerFinishedEvent); return this.currentState; } }
new RMAppAttemptContainerFinishedEvent(appAttemptId, status, nodeId); rmContext.getDispatcher().getEventHandler().handle(evt);