diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java index e15198b..fa4c0cf 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java @@ -47,9 +47,11 @@ import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenResponse; import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenRequest; import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenResponse; +import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationReport; +import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerReport; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; @@ -128,13 +130,17 @@ public CancelDelegationTokenResponse cancelDelegationToken( public GetApplicationAttemptReportResponse getApplicationAttemptReport( GetApplicationAttemptReportRequest request) throws YarnException, IOException { + ApplicationAttemptId appAttemptId = request.getApplicationAttemptId(); try { GetApplicationAttemptReportResponse response = GetApplicationAttemptReportResponse.newInstance(history - .getApplicationAttempt(request.getApplicationAttemptId())); + .getApplicationAttempt(appAttemptId)); return response; } catch (IOException e) { - throw new ApplicationAttemptNotFoundException(e.getMessage()); + String msg = "ApplicationAttempt with id '" + appAttemptId + + "' doesn't exist in the history store."; + LOG.error(msg, e); + throw new ApplicationAttemptNotFoundException(msg); } } @@ -152,14 +158,17 @@ public GetApplicationAttemptsResponse getApplicationAttempts( @Override public GetApplicationReportResponse getApplicationReport( GetApplicationReportRequest request) throws YarnException, IOException { + ApplicationId applicationId = request.getApplicationId(); try { - ApplicationId applicationId = request.getApplicationId(); GetApplicationReportResponse response = GetApplicationReportResponse.newInstance(history .getApplication(applicationId)); return response; } catch (IOException e) { - throw new ApplicationNotFoundException(e.getMessage()); + String msg = "Application with id '" + applicationId + + "' doesn't exist in the history store."; + LOG.error(msg, e); + throw new ApplicationNotFoundException(msg); } } @@ -175,13 +184,17 @@ public GetApplicationsResponse getApplications( @Override public GetContainerReportResponse getContainerReport( GetContainerReportRequest request) throws YarnException, IOException { + ContainerId containerId = request.getContainerId(); try { GetContainerReportResponse response = - GetContainerReportResponse.newInstance(history.getContainer(request - .getContainerId())); + GetContainerReportResponse.newInstance( + history.getContainer(containerId)); return response; } catch (IOException e) { - throw new ContainerNotFoundException(e.getMessage()); + String msg = "Container with id '" + containerId + + "' doesn't exist in the history store."; + LOG.error(msg, e); + throw new ContainerNotFoundException(msg); } } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java index d8554bd..2ceda589 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java @@ -326,8 +326,9 @@ public GetApplicationAttemptReportResponse getApplicationAttemptReport( if (allowAccess) { RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId); if (appAttempt == null) { - throw new ApplicationAttemptNotFoundException("ApplicationAttempt " - + appAttemptId + " Not Found in RM"); + throw new ApplicationAttemptNotFoundException( + "ApplicationAttempt with id '" + appAttemptId + + "' doesn't exist in RM."); } ApplicationAttemptReport attemptReport = appAttempt .createApplicationAttemptReport(); @@ -411,14 +412,15 @@ public GetContainerReportResponse getContainerReport( if (allowAccess) { RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId); if (appAttempt == null) { - throw new ApplicationAttemptNotFoundException("ApplicationAttempt " - + appAttemptId + " Not Found in RM"); + throw new ApplicationAttemptNotFoundException( + "ApplicationAttempt with id '" + appAttemptId + + "' doesn't exist in RM."); } RMContainer rmConatiner = this.rmContext.getScheduler().getRMContainer( containerId); if (rmConatiner == null) { - throw new ContainerNotFoundException("Container with id " + containerId - + " not found"); + throw new ContainerNotFoundException("Container with id '" + containerId + + "' doesn't exist in RM."); } response = GetContainerReportResponse.newInstance(rmConatiner .createContainerReport()); @@ -460,8 +462,9 @@ public GetContainersResponse getContainers(GetContainersRequest request) if (allowAccess) { RMAppAttempt appAttempt = application.getAppAttempts().get(appAttemptId); if (appAttempt == null) { - throw new ApplicationAttemptNotFoundException("ApplicationAttempt " - + appAttemptId + " Not Found in RM"); + throw new ApplicationAttemptNotFoundException( + "ApplicationAttempt with id '" + appAttemptId + + "' doesn't exist in RM."); } Collection rmContainers = Collections.emptyList(); SchedulerAppReport schedulerAppReport =