Search in sources :

Example 1 with AppAttemptsInfo

use of org.apache.hadoop.yarn.server.webapp.dao.AppAttemptsInfo 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;
}
Also used : AppAttemptsInfo(org.apache.hadoop.yarn.server.webapp.dao.AppAttemptsInfo) AppAttemptInfo(org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo) ApplicationAttemptReport(org.apache.hadoop.yarn.api.records.ApplicationAttemptReport) GetApplicationAttemptsRequest(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest) PrivilegedExceptionAction(java.security.PrivilegedExceptionAction) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) ForbiddenException(org.apache.hadoop.yarn.webapp.ForbiddenException) AuthorizationException(org.apache.hadoop.security.authorize.AuthorizationException) ContainerNotFoundException(org.apache.hadoop.yarn.exceptions.ContainerNotFoundException) NotFoundException(org.apache.hadoop.yarn.webapp.NotFoundException) ApplicationAttemptNotFoundException(org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) WebApplicationException(javax.ws.rs.WebApplicationException) ApplicationNotFoundException(org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException) BadRequestException(org.apache.hadoop.yarn.webapp.BadRequestException) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation)

Aggregations

UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)1 AuthorizationException (org.apache.hadoop.security.authorize.AuthorizationException)1 GetApplicationAttemptsRequest (org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest)1 ApplicationAttemptReport (org.apache.hadoop.yarn.api.records.ApplicationAttemptReport)1 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)1 ApplicationAttemptNotFoundException (org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException)1 ApplicationNotFoundException (org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException)1 ContainerNotFoundException (org.apache.hadoop.yarn.exceptions.ContainerNotFoundException)1 AppAttemptInfo (org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo)1 AppAttemptsInfo (org.apache.hadoop.yarn.server.webapp.dao.AppAttemptsInfo)1 BadRequestException (org.apache.hadoop.yarn.webapp.BadRequestException)1 ForbiddenException (org.apache.hadoop.yarn.webapp.ForbiddenException)1 NotFoundException (org.apache.hadoop.yarn.webapp.NotFoundException)1