use of org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest in project hadoop by apache.
the class WebServices method getAppAttempts.
public AppAttemptsInfo getAppAttempts(HttpServletRequest req, HttpServletResponse res, String appId) {
UserGroupInformation callerUGI = getUser(req);
final ApplicationId id = parseApplicationId(appId);
Collection<ApplicationAttemptReport> appAttemptReports = null;
try {
if (callerUGI == null) {
GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.newInstance(id);
appAttemptReports = appBaseProt.getApplicationAttempts(request).getApplicationAttemptList();
} else {
appAttemptReports = callerUGI.doAs(new PrivilegedExceptionAction<Collection<ApplicationAttemptReport>>() {
@Override
public Collection<ApplicationAttemptReport> run() throws Exception {
GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.newInstance(id);
return appBaseProt.getApplicationAttempts(request).getApplicationAttemptList();
}
});
}
} catch (Exception e) {
rewrapAndThrowException(e);
}
AppAttemptsInfo appAttemptsInfo = new AppAttemptsInfo();
if (appAttemptReports == null) {
return appAttemptsInfo;
}
for (ApplicationAttemptReport appAttemptReport : appAttemptReports) {
AppAttemptInfo appAttemptInfo = new AppAttemptInfo(appAttemptReport);
appAttemptsInfo.add(appAttemptInfo);
}
return appAttemptsInfo;
}
Aggregations