Partial backport of YARN-7934 to avoid NPE on RM UI
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0f0a4233 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0f0a4233 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0f0a4233 Branch: refs/heads/YARN-8200 Commit: 0f0a4233f833357fde8a85b6b5e671f3cb8d5e7c Parents: bbda5d4 Author: Jonathan Hung <jh...@linkedin.com> Authored: Thu Apr 19 16:47:36 2018 -0700 Committer: Konstantin V Shvachko <kshvac...@linkedin.com> Committed: Wed May 2 13:19:58 2018 -0700 ---------------------------------------------------------------------- .../yarn/server/resourcemanager/webapp/dao/ResourceInfo.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/0f0a4233/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ResourceInfo.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/webapp/dao/ResourceInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ResourceInfo.java index e13980a..dd80d20 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ResourceInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ResourceInfo.java @@ -62,7 +62,7 @@ public class ResourceInfo { @Override public String toString() { - return resources.toString(); + return getResource().toString(); } public void setMemory(int memory) { @@ -82,6 +82,9 @@ public class ResourceInfo { } public Resource getResource() { + if (resources == null) { + resources = Resource.newInstance(memory, vCores); + } return Resource.newInstance(resources); } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org