From 7d2eeaecc806c69e1cb096f96daae9d05371f4af Mon Sep 17 00:00:00 2001 From: zhuqi-lucas <821684824@qq.com> Date: Wed, 19 May 2021 21:24:26 +0800 Subject: [PATCH] YARN-10701. The yarn.resource-types should support multi types without trimmed. Contributed by Qi Zhu. --- .../org/apache/hadoop/yarn/util/resource/ResourceUtils.java | 3 ++- .../src/test/resources/resource-types-test.xml | 4 ++-- 2 files changed, 4 insertions(+), 3 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 fea9eefb16..3654965c05 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 @@ -251,7 +251,8 @@ public static Resource fetchMaximumAllocationFromConfig(Configuration conf) { private static Map getResourceInformationMapFromConfig( Configuration conf) { Map resourceInformationMap = new HashMap<>(); - String[] resourceNames = conf.getStrings(YarnConfiguration.RESOURCE_TYPES); + String[] resourceNames = + conf.getTrimmedStrings(YarnConfiguration.RESOURCE_TYPES); if (resourceNames != null && resourceNames.length != 0) { for (String resourceName : resourceNames) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/resources/resource-types-test.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/resources/resource-types-test.xml index 98e49617d0..e3be52e765 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/resources/resource-types-test.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/resources/resource-types-test.xml @@ -17,6 +17,6 @@ yarn.resource-types - yarn.io/gpu,yarn.io/fpga,testType + yarn.io/gpu, yarn.io/fpga, testType - \ No newline at end of file +