You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ac...@apache.org on 2015/02/06 08:49:06 UTC

hadoop git commit: YARN-1904. Ensure exceptions thrown in ClientRMService & ApplicationHistoryClientService are uniform when application-attempt is not found. Contributed by Zhijie Shen.

Repository: hadoop
Updated Branches:
  refs/heads/trunk 7b10ef0c3 -> 18b2507ed


YARN-1904. Ensure exceptions thrown in ClientRMService & ApplicationHistoryClientService are uniform when application-attempt is not found. Contributed by Zhijie Shen.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/18b2507e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/18b2507e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/18b2507e

Branch: refs/heads/trunk
Commit: 18b2507edaac991e3ed68d2f27eb96f6882137b9
Parents: 7b10ef0
Author: Arun C. Murthy <ac...@apache.org>
Authored: Thu Feb 5 23:48:39 2015 -0800
Committer: Arun C. Murthy <ac...@apache.org>
Committed: Thu Feb 5 23:48:55 2015 -0800

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                 |  4 +++
 .../ApplicationHistoryClientService.java        | 27 +++++++++++++++-----
 .../server/resourcemanager/ClientRMService.java | 19 ++++++++------
 3 files changed, 35 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/18b2507e/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 805ec66..fa0d8ab 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -248,6 +248,10 @@ Release 2.7.0 - UNRELEASED
     YARN-1582. Capacity Scheduler: add a maximum-allocation-mb setting per
     queue (Thomas Graves via jlowe)
 
+    YARN-1904. Ensure exceptions thrown in ClientRMService &
+    ApplicationHistoryClientService are uniform when application-attempt is
+    not found. (zjshen via acmurthy)
+
   OPTIMIZATIONS
 
   BUG FIXES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/18b2507e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java
index 4c04c5c..8da1ea1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java
@@ -49,9 +49,11 @@ import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenRequest;
 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;
@@ -153,13 +155,17 @@ public class ApplicationHistoryClientService extends AbstractService {
     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);
       }
     }
 
@@ -177,14 +183,17 @@ public class ApplicationHistoryClientService extends AbstractService {
     @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);
       }
     }
 
@@ -200,13 +209,17 @@ public class ApplicationHistoryClientService extends AbstractService {
     @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);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/18b2507e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java
index 0c37eb9..d3ccb91 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java
@@ -366,8 +366,9 @@ public class ClientRMService extends AbstractService implements
     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();
@@ -451,14 +452,15 @@ public class ClientRMService extends AbstractService implements
     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());
@@ -500,8 +502,9 @@ public class ClientRMService extends AbstractService implements
     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<RMContainer> rmContainers = Collections.emptyList();
       SchedulerAppReport schedulerAppReport =