From ce1a4419a6c938447a675c416567db56bf9cb29e Mon Sep 17 00:00:00 2001 From: Xuan Date: Mon, 27 Oct 2014 10:26:21 -0700 Subject: [PATCH] YARN-2726. CapacityScheduler should explicitly log when an accessible label has no capacity. Contributed by Wangda Tan --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../capacity/CapacitySchedulerConfiguration.java | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 11c1ac1352..009366b273 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -763,6 +763,9 @@ Release 2.6.0 - UNRELEASED YARN-2734. Skipped sub-folders in the local log dir when aggregating logs. (Xuan Gong via zjshen) + YARN-2726. CapacityScheduler should explicitly log when an accessible + label has no capacity. (Wangda Tan via xgong) + Release 2.5.1 - 2014-09-05 INCOMPATIBLE CHANGES 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 5beed37135..b36172c895 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 @@ -466,12 +466,19 @@ public Map getNodeLabelCapacities(String queue, nodeLabelCapacities.put(label, 1.0f); continue; } - float capacity = - getFloat(getNodeLabelPrefix(queue, label) + CAPACITY, UNDEFINED); + String capacityPropertyName = getNodeLabelPrefix(queue, label) + CAPACITY; + float capacity = getFloat(capacityPropertyName, UNDEFINED); + if (capacity == UNDEFINED) { + throw new IllegalArgumentException("Configuration issue: " + + " node-label=" + label + " is accessible from queue=" + queue + + " but has no capacity set, you should set " + + capacityPropertyName + " in range of [0, 100]."); + } if (capacity < MINIMUM_CAPACITY_VALUE || capacity > MAXIMUM_CAPACITY_VALUE) { - throw new IllegalArgumentException("Illegal " + "capacity of " - + capacity + " for label=" + label + " in queue=" + queue); + throw new IllegalArgumentException("Illegal capacity of " + capacity + + " for node-label=" + label + " in queue=" + queue + + ", valid capacity should in range of [0, 100]."); } if (LOG.isDebugEnabled()) { LOG.debug("CSConf - getCapacityOfLabel: prefix="