From 110c0862329bfebe3ded8910289ae8e9c59f21c9 Mon Sep 17 00:00:00 2001 From: Sunil G Date: Sat, 30 Sep 2017 11:41:41 +0530 Subject: [PATCH] YARN-7205 --- .../hadoop/yarn/util/resource/ResourceUtils.java | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/ResourceUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/ResourceUtils.java index 0564d74..9335da1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/ResourceUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/resource/ResourceUtils.java @@ -22,8 +22,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.api.protocolrecords.ResourceTypes; import org.apache.hadoop.yarn.api.records.Resource; @@ -342,11 +340,14 @@ private static void initializeResourceTypesIfNeeded(Configuration conf, } try { addResourcesFileToConf(resourceFile, conf); - LOG.debug("Found " + resourceFile + ", adding to configuration"); + if (LOG.isDebugEnabled()) { + LOG.debug("Found " + resourceFile + ", adding to configuration"); + } } catch (FileNotFoundException fe) { - LOG.debug("Unable to find '" + resourceFile + "'."); + if (LOG.isDebugEnabled()) { + LOG.debug("Unable to find '" + resourceFile + "'."); + } } - initializeResourcesMap(conf); } } @@ -387,7 +388,9 @@ private static void addResourcesFileToConf(String resourceFile, Configuration conf) throws FileNotFoundException { try { InputStream ris = getConfInputStream(resourceFile, conf); - LOG.debug("Found " + resourceFile + ", adding to configuration"); + if (LOG.isDebugEnabled()) { + LOG.debug("Found " + resourceFile + ", adding to configuration"); + } conf.addResource(ris); } catch (FileNotFoundException fe) { throw fe; @@ -471,7 +474,10 @@ public static String getUnits(String resourceValue) { } } } catch (FileNotFoundException fe) { - LOG.info("Couldn't find node resources file"); + if (LOG.isDebugEnabled()) { + LOG.debug("Couldn't find node resources file named:" + + YarnConfiguration.NODE_RESOURCES_CONFIGURATION_FILE); + } } return nodeResources; } @@ -491,8 +497,10 @@ private static void addResourceInformation(String prop, String value, Long.valueOf(value.substring(0, value.length() - units.length())); nodeResources.get(resourceType).setValue(resourceValue); nodeResources.get(resourceType).setUnits(units); - LOG.debug("Setting value for resource type " + resourceType + " to " - + resourceValue + " with units " + units); + if (LOG.isDebugEnabled()) { + LOG.debug("Setting value for resource type " + resourceType + " to " + + resourceValue + " with units " + units); + } } } -- 2.10.1 (Apple Git-78)