* Utility to build the final "job run is finished" request to the RM.
* @return the finish app master request, to send to the RM.
*/
private FinishApplicationMasterRequest buildFinishAppMasterRequest() {
LOG.info("Application completed. Signalling finish to RM");
FinishApplicationMasterRequest finishRequest =
Records.newRecord(FinishApplicationMasterRequest.class);
finishRequest.setAppAttemptId(appAttemptId);
FinalApplicationStatus appStatus;
String appMessage = "Container Diagnostics: " +
" allocated=" + allocatedCount.get() +
", completed=" + completedCount.get() +
", succeeded=" + successfulCount.get() +
", failed=" + failedCount.get();
if (successfulCount.get() == containersToLaunch) {
appStatus = FinalApplicationStatus.SUCCEEDED;
} else {
appStatus = FinalApplicationStatus.FAILED;
}
finishRequest.setDiagnostics(appMessage);
finishRequest.setFinishApplicationStatus(appStatus);
return finishRequest;
}