Search in sources :

Example 16 with GetApplicationReportResponse

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();
}
Also used : GetApplicationReportRequest(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest) ApplicationNotFoundException(org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException) GetApplicationReportResponse(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse)

Example 17 with GetApplicationReportResponse

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;
}
Also used : ApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationReport) RMApp(org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp) ApplicationNotFoundException(org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException) IOException(java.io.IOException) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) GetApplicationReportResponse(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation)

Aggregations

GetApplicationReportResponse (org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse)17 GetApplicationReportRequest (org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest)12 ApplicationReport (org.apache.hadoop.yarn.api.records.ApplicationReport)10 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)7 Test (org.junit.Test)5 IOException (java.io.IOException)4 ApplicationClientProtocol (org.apache.hadoop.yarn.api.ApplicationClientProtocol)4 ApplicationNotFoundException (org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException)4 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)3 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)3 RMApp (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp)3 ServiceException (com.google.protobuf.ServiceException)2 SaslException (javax.security.sasl.SaslException)2 RemoteException (org.apache.hadoop.ipc.RemoteException)2 ContainerManagementProtocol (org.apache.hadoop.yarn.api.ContainerManagementProtocol)2 RegisterApplicationMasterResponse (org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse)2 StartContainersResponse (org.apache.hadoop.yarn.api.protocolrecords.StartContainersResponse)2 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)2 DrainDispatcher (org.apache.hadoop.yarn.event.DrainDispatcher)2 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)2