From f4f210d2e57e49999579efb7db039cc623798267 Mon Sep 17 00:00:00 2001 From: Jonathan Hung Date: Wed, 25 Sep 2019 17:48:40 -0700 Subject: [PATCH] Addendum to YARN-9730. Support forcing configured partitions to be exclusive based on app node label (cherry picked from commit d86a1acc866cbda845fb3896dc824baf12217383) --- .../hadoop/yarn/server/resourcemanager/RMContextImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java index cc48e8b7874..cb5cd019545 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMContextImpl.java @@ -648,9 +648,13 @@ public class RMContextImpl implements RMContext { } public Set getExclusiveEnforcedPartitions() { - String[] configuredPartitions = getYarnConfiguration().getStrings( - YarnConfiguration.EXCLUSIVE_ENFORCED_PARTITIONS); Set exclusiveEnforcedPartitions = new HashSet<>(); + Configuration conf = getYarnConfiguration(); + if (conf == null) { + return new HashSet<>(); + } + String[] configuredPartitions = conf.getStrings( + YarnConfiguration.EXCLUSIVE_ENFORCED_PARTITIONS); if (configuredPartitions != null) { for (String partition : configuredPartitions) { exclusiveEnforcedPartitions.add(partition);