private void logApplicationReport(ApplicationReport appReport) { LOG.info("Application " + appReport.getApplicationId() + " finished with state " + appReport .getYarnApplicationState() + " and final state " + appReport .getFinalApplicationStatus() + " at " + appReport.getFinishTime()); if (appReport.getYarnApplicationState() == YarnApplicationState.FAILED) { LOG.warn("Application failed. Diagnostics " + appReport.getDiagnostics()); LOG.warn("If log aggregation is activated in the Hadoop cluster, we recommend to retrieve " + "the full application log using this command:" + System.lineSeparator() + "\tyarn logs -applicationId " + appReport.getApplicationId() + System.lineSeparator() + "(It sometimes takes a few seconds until the logs are aggregated)"); } }
/** * Wait for the application to enter one of the completion states. This is an * informal implementation useful for testing. * * @throws YarnClientException */ public void waitForCompletion() throws YarnClientException { ApplicationReport appReport; YarnApplicationState appState; for (;;) { appReport = getAppReport(); appState = appReport.getYarnApplicationState(); if (appState == YarnApplicationState.FINISHED || appState == YarnApplicationState.KILLED || appState == YarnApplicationState.FAILED) { break; } try { Thread.sleep(100); } catch (InterruptedException e) { // Should never occur. } } System.out.println("Application " + appId + " finished with" + " state " + appState + " at " + appReport.getFinishTime()); }
.append("\n"); messageBuilder.append("\tStart time: ").append(applicationReport.get().getStartTime()).append("\n"); messageBuilder.append("\tFinish time: ").append(applicationReport.get().getFinishTime()).append("\n");
case KILLED: appStatusBuilder.maybeCreateAndGetAmInfo().setAppId(applicationId); appStatusBuilder.setAppFinishTime(appReport.getFinishTime()); appStatusBuilder.setState(State.COMPLETE);
@Override public synchronized long getFinishTime() { return report.getFinishTime(); }
@Override public long getFinishTime() { return report.getFinishTime(); }
@Override public long getFinishTime() { return report.getFinishTime(); }
@Override public long getFinishTime() { return report.getFinishTime(); }
@Override public int compare(ApplicationReport r1, ApplicationReport r2) { long x = r1.getFinishTime(); long y = r2.getFinishTime(); return compareTwoLongsReverse(x, y); } }
@Override public int compare(ApplicationReport r1, ApplicationReport r2) { long x = r1.getFinishTime(); long y = r2.getFinishTime(); return compareTwoLongsReverse(x, y); } }
@Override public int compare(ApplicationReport r1, ApplicationReport r2) { long started1 = r1.getStartTime(); long started2 = r2.getStartTime(); long finished1 = r1.getFinishTime(); long finished2 = r2.getFinishTime(); long lastEvent1 = Math.max(started1, finished1); long lastEvent2 = Math.max(started2, finished2); return compareTwoLongsReverse(lastEvent1, lastEvent2); } }
@Override public int compare(ApplicationReport r1, ApplicationReport r2) { long started1 = r1.getStartTime(); long started2 = r2.getStartTime(); long finished1 = r1.getFinishTime(); long finished2 = r2.getFinishTime(); long lastEvent1 = Math.max(started1, finished1); long lastEvent2 = Math.max(started2, finished2); return compareTwoLongsReverse(lastEvent1, lastEvent2); } }
private void logFinalApplicationReport(ApplicationReport appReport) { LOG.info("Application " + appReport.getApplicationId() + " finished with state " + appReport .getYarnApplicationState() + " and final state " + appReport .getFinalApplicationStatus() + " at " + appReport.getFinishTime()); if (appReport.getYarnApplicationState() == YarnApplicationState.FAILED) { LOG.warn("Application failed. Diagnostics " + appReport.getDiagnostics()); LOG.warn("If log aggregation is activated in the Hadoop cluster, we recommend to retrieve " + "the full application log using this command:" + System.lineSeparator() + "\tyarn logs -applicationId " + appReport.getApplicationId() + System.lineSeparator() + "(It sometimes takes a few seconds until the logs are aggregated)"); } }
private void logFinalApplicationReport(ApplicationReport appReport) { LOG.info("Application " + appReport.getApplicationId() + " finished with state " + appReport .getYarnApplicationState() + " and final state " + appReport .getFinalApplicationStatus() + " at " + appReport.getFinishTime()); if (appReport.getYarnApplicationState() == YarnApplicationState.FAILED) { LOG.warn("Application failed. Diagnostics " + appReport.getDiagnostics()); LOG.warn("If log aggregation is activated in the Hadoop cluster, we recommend to retrieve " + "the full application log using this command:" + System.lineSeparator() + "\tyarn logs -applicationId " + appReport.getApplicationId() + System.lineSeparator() + "(It sometimes takes a few seconds until the logs are aggregated)"); } }
private int printFinalJobReport() throws YarnException, IOException { try { ApplicationReport report = this.yarnClient.getApplicationReport(getAppId()); FinalApplicationStatus finalAppStatus = report.getFinalApplicationStatus(); final long secs = (report.getFinishTime() - report.getStartTime()) / 1000L; final String time = String.format("%d minutes, %d seconds.", secs / 60L, secs % 60L); LOG.info("Completed {}: {}, total running time: {}", getAppName(), finalAppStatus.name(), time); return finalAppStatus == FinalApplicationStatus.SUCCEEDED ? 0 : -1; } catch (YarnException yre) { LOG.error(String.format("Exception encountered while attempting to request a final job report for %s.", getAppId()), yre); return -1; } }
private int printFinalJobReport() throws YarnException, IOException { try { ApplicationReport report = this.yarnClient.getApplicationReport(getAppId()); FinalApplicationStatus finalAppStatus = report.getFinalApplicationStatus(); final long secs = (report.getFinishTime() - report.getStartTime()) / 1000L; final String time = String.format("%d minutes, %d seconds.", secs / 60L, secs % 60L); LOG.info("Completed {}: {}, total running time: {}", getAppName(), finalAppStatus.name(), time); return finalAppStatus == FinalApplicationStatus.SUCCEEDED ? 0 : -1; } catch (YarnException yre) { LOG.error(String.format("Exception encountered while attempting to request a final job report for %s.", getAppId()), yre); return -1; } }
@Override public GetJobReportResponse getJobReport(GetJobReportRequest request) throws IOException { JobReport jobReport = recordFactory.newRecordInstance(JobReport.class); jobReport.setJobId(request.getJobId()); jobReport.setJobState(jobState); jobReport.setUser(applicationReport.getUser()); jobReport.setStartTime(applicationReport.getStartTime()); jobReport.setDiagnostics(applicationReport.getDiagnostics()); jobReport.setJobName(applicationReport.getName()); jobReport.setTrackingUrl(applicationReport.getTrackingUrl()); jobReport.setFinishTime(applicationReport.getFinishTime()); GetJobReportResponse resp = recordFactory.newRecordInstance(GetJobReportResponse.class); resp.setJobReport(jobReport); return resp; }
public SerializedApplicationReport(ApplicationReport report) { this.applicationId = report.getApplicationId().toString(); ApplicationAttemptId attemptId = report.getCurrentApplicationAttemptId(); this.applicationAttemptId = attemptId != null ? attemptId.toString() : "N/A"; this.name = report.getName(); this.applicationType = report.getApplicationType(); this.user = report.getUser(); this.queue = report.getQueue(); this.host = report.getHost(); this.rpcPort = report.getRpcPort(); this.state = report.getYarnApplicationState().toString(); this.diagnostics = report.getDiagnostics(); this.startTime = report.getStartTime(); this.finishTime = report.getFinishTime(); FinalApplicationStatus appStatus = report.getFinalApplicationStatus(); this.finalStatus = appStatus == null ? "" : appStatus.toString(); this.progress = report.getProgress(); this.url = report.getTrackingUrl(); this.origTrackingUrl= report.getOriginalTrackingUrl(); }
private ApplicationReport verifyAppReportAfterRMRestart(RMApp app, MockRM rm) throws Exception { GetApplicationReportRequest reportRequest = GetApplicationReportRequest.newInstance(app.getApplicationId()); GetApplicationReportResponse response = rm.getClientRMService().getApplicationReport(reportRequest); ApplicationReport report = response.getApplicationReport(); Assert.assertEquals(app.getStartTime(), report.getStartTime()); Assert.assertEquals(app.getFinishTime(), report.getFinishTime()); Assert.assertEquals(app.createApplicationState(), report.getYarnApplicationState()); Assert.assertTrue(1 == report.getProgress()); return response.getApplicationReport(); }
private ApplicationReport verifyAppReportAfterRMRestart(RMApp app, MockRM rm) throws Exception { GetApplicationReportRequest reportRequest = GetApplicationReportRequest.newInstance(app.getApplicationId()); GetApplicationReportResponse response = rm.getClientRMService().getApplicationReport(reportRequest); ApplicationReport report = response.getApplicationReport(); Assert.assertEquals(app.getStartTime(), report.getStartTime()); Assert.assertEquals(app.getFinishTime(), report.getFinishTime()); Assert.assertEquals(app.createApplicationState(), report.getYarnApplicationState()); Assert.assertTrue(1 == report.getProgress()); return response.getApplicationReport(); }