From c78c0e277f8f8a15288ece928f24b8a2db7259e4 Mon Sep 17 00:00:00 2001 From: Sanford Ryza Date: Tue, 19 Nov 2013 22:22:00 +0000 Subject: [PATCH] YARN-786: Addendum so that RMAppAttemptImpl#getApplicationResourceUsageReport won't return null git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1543597 13f79535-47bb-0310-9956-ffa450edef68 --- .../rmapp/attempt/RMAppAttemptImpl.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java index dc15e7af4e..5bfd178de2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java @@ -53,6 +53,7 @@ import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.Priority; +import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.ResourceRequest; import org.apache.hadoop.yarn.event.EventHandler; import org.apache.hadoop.yarn.factories.RecordFactory; @@ -653,7 +654,14 @@ public void handle(RMAppAttemptEvent event) { public ApplicationResourceUsageReport getApplicationResourceUsageReport() { this.readLock.lock(); try { - return scheduler.getAppResourceUsageReport(this.getAppAttemptId()); + ApplicationResourceUsageReport report = + scheduler.getAppResourceUsageReport(this.getAppAttemptId()); + if (report == null) { + Resource none = Resource.newInstance(0, 0); + report = ApplicationResourceUsageReport.newInstance(0, 0, none, none, + none); + } + return report; } finally { this.readLock.unlock(); }