From 72801be13af9938ae67a675fe212d38df65ba23b Mon Sep 17 00:00:00 2001 From: Szilard Nemeth Date: Wed, 28 Jul 2021 14:55:19 +0200 Subject: [PATCH] YARN-10813. Set default capacity of root for node labels. Contributed by Andras Gyori --- .../scheduler/capacity/CapacitySchedulerConfiguration.java | 5 +++-- 1 file changed, 3 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/scheduler/capacity/CapacitySchedulerConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java index 047beeb425..9d4b6e24ef 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java @@ -712,10 +712,11 @@ private float internalGetLabeledQueueCapacity(String queue, String label, String // root.From AbstractCSQueue, absolute resource will be parsed and // updated. Once nodes are added/removed in cluster, capacity in // percentage will also be re-calculated. - return defaultValue; + return queue.equals("root") ? 100.0f : defaultValue; } - float capacity = getFloat(capacityPropertyName, defaultValue); + float capacity = queue.equals("root") ? 100.0f + : getFloat(capacityPropertyName, defaultValue); if (capacity < MINIMUM_CAPACITY_VALUE || capacity > MAXIMUM_CAPACITY_VALUE) { throw new IllegalArgumentException("Illegal capacity of " + capacity