use of org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse in project hadoop by apache.
the class YarnClientImpl method getApplicationReport.
@Override
public ApplicationReport getApplicationReport(ApplicationId appId) throws YarnException, IOException {
GetApplicationReportResponse response = null;
try {
GetApplicationReportRequest request = Records.newRecord(GetApplicationReportRequest.class);
request.setApplicationId(appId);
response = rmClient.getApplicationReport(request);
} catch (ApplicationNotFoundException e) {
if (!historyServiceEnabled) {
// Just throw it as usual if historyService is not enabled.
throw e;
}
return historyClient.getApplicationReport(appId);
}
return response.getApplicationReport();
}
use of org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse in project hadoop by apache.
the class ClientRMService method getApplicationReport.
/**
* It gives response which includes application report if the application
* present otherwise throws ApplicationNotFoundException.
*/
@Override
public GetApplicationReportResponse getApplicationReport(GetApplicationReportRequest request) throws YarnException {
ApplicationId applicationId = request.getApplicationId();
if (applicationId == null) {
throw new ApplicationNotFoundException("Invalid application id: null");
}
UserGroupInformation callerUGI;
try {
callerUGI = UserGroupInformation.getCurrentUser();
} catch (IOException ie) {
LOG.info("Error getting UGI ", ie);
throw RPCUtil.getRemoteException(ie);
}
RMApp application = this.rmContext.getRMApps().get(applicationId);
if (application == null) {
// ApplicationNotFoundException and let client to handle.
throw new ApplicationNotFoundException("Application with id '" + applicationId + "' doesn't exist in RM. Please check " + "that the job submission was successful.");
}
boolean allowAccess = checkAccess(callerUGI, application.getUser(), ApplicationAccessType.VIEW_APP, application);
ApplicationReport report = application.createAndGetApplicationReport(callerUGI.getUserName(), allowAccess);
GetApplicationReportResponse response = recordFactory.newRecordInstance(GetApplicationReportResponse.class);
response.setApplicationReport(report);
return response;
}
Aggregations