From 3d4ea4b33650376e28718986d87078503d81ad99 Mon Sep 17 00:00:00 2001 From: Eric Badger Date: Thu, 18 Mar 2021 19:36:50 +0000 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 | 2 +- 2 files changed, 3 insertions(+), 2 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 f7e7f35a89..f7c75a6079 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 e68df3e10a..be4f07428c 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/gpu, yarn.io/fpga \ No newline at end of file