From 078dfb09fe96235f53263eb6a7c7703f8c3f4c74 Mon Sep 17 00:00:00 2001 From: Jonathan Hung Date: Thu, 3 Jan 2019 15:58:10 -0500 Subject: [PATCH] YARN-9175. Null resources check in ResourceInfo for branch-3.0 (cherry picked from commit a0291a015c1af0ea1282849bd8fb32824d7452fa) --- .../yarn/server/resourcemanager/webapp/dao/ResourceInfo.java | 5 ++++- 1 file changed, 4 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/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 e13980afc39..dd80d205a17 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); } }