Hean-Chhinling commented on code in PR #8641:
URL: https://github.com/apache/hadoop/pull/8641#discussion_r3895413213
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfigValidator.java:
##########
@@ -114,6 +120,68 @@ public static void validateVCores(Configuration conf) {
}
}
+ /**
+ * Validates that queue's partition capacity.
+ * It could only be configured if the queue is accessible by that label and
vice versa,
+ * the label that is accessible by the queue could not be removed if
+ * it has capacity or max-capacity configured in queue's partition
+ *
+ * @param conf Capacity Scheduler configuration to validate
+ * @throws IOException when the above rules have been violated
+ */
+ public static void validateQueueAccessibleLabels(Configuration conf) throws
IOException {
+ CapacitySchedulerConfiguration csConf = new
CapacitySchedulerConfiguration(conf);
+
+ for (String queuePath : csConf.getConfiguredNodeLabelsByQueue().keySet()) {
+ QueuePath queue = new QueuePath(queuePath);
+ if (queue.isRoot()) {
+ continue;
+ }
+
+ for (String label : csConf.getConfiguredNodeLabels(queue)) {
+ if (RMNodeLabelsManager.NO_LABEL.equals(label)
+ || !hasQueuePartitionCapacity(csConf, queue, label)
+ || isLabelAccessibleByQueue(csConf, queue, label)) {
+ continue;
+ }
+
+ throw new IOException("Queue: " + queuePath +
+ " must have accessible-node-labels and its capacity together");
+ }
+ }
+ }
+
+ private static boolean hasQueuePartitionCapacity(
+ CapacitySchedulerConfiguration conf, QueuePath queue, String label) {
+ String labelPrefix = QueuePrefixes.getNodeLabelPrefix(queue, label);
+ String capacity = conf.get(labelPrefix + CAPACITY);
+ if (capacity != null && !capacity.trim().isEmpty()) {
+ return true;
+ }
+ String maxCapacity = conf.get(labelPrefix + MAXIMUM_CAPACITY);
+ return maxCapacity != null && !maxCapacity.trim().isEmpty();
+ }
+
+ /**
+ * Requires queue in the queue-path to declare accessible-node-labels
explicitly.
+ * The inheritance from root’s implicit * label is not accepted here.
Review Comment:
I am thinking of restoring back the implicit root queue inheritance. However
that would cause the bug to still occur.
E.g. The `root.default.leaf` does not have `accessible-node-labels` to
`label3` then if it goes always up to `root` it will behave as if the
`root.default.leaf` is accessible to `label3`. That is not an ideal way and
would cause this bug.
What do you think of updating the existing the documentation instead?
Although the `root` implicit inheritance but the normal parent queue
inheritance is not modified. Probably, it is only a small tweak in the
documentation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]