tomicooler commented on code in PR #5783:
URL: https://github.com/apache/hadoop/pull/5783#discussion_r1252757919


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/AbstractCSQueue.java:
##########
@@ -422,10 +458,20 @@ protected void setDynamicQueueProperties() {
           .getConfiguredNodeLabelsForAllQueues()
           .getLabelsByQueue(parentTemplate);
 
-      if (parentNodeLabels != null && parentNodeLabels.size() > 1) {
-        queueContext.getQueueManager()
-            .getConfiguredNodeLabelsForAllQueues()
-            .setLabelsByQueue(getQueuePath(), new HashSet<>(parentNodeLabels));
+      if (parentNodeLabels != null) {
+        if (parentNodeLabels.size() > 1) {
+          queueContext.getQueueManager().getConfiguredNodeLabelsForAllQueues()
+              .setLabelsByQueue(getQueuePath(), new 
HashSet<>(parentNodeLabels));
+        }
+        // Default to weight 1
+        for (String label : parentNodeLabels) {
+          float weightByLabel = queueContext.getConfiguration()
+              .getLabeledQueueWeight(queuePath, label);
+          if (weightByLabel == -1) {
+            queueContext.getConfiguration()
+                .setLabeledQueueWeight(queuePath.getFullPath(), label, 1);
+          }
+        }

Review Comment:
   BTW this is done in legacy mode, in APQ:
   
   ```
         // Normalize all dynamic queue queue's weight to 1 for all accessible 
node
         // labels, this is important because existing node labels could keep
         // changing when new node added, or node label mapping changed. We need
         // this to ensure auto created queue can access all labels.
         for (String nodeLabel : queueCapacities.getExistingNodeLabels()) {
           for (CSQueue queue : childQueues) {
             // For dynamic queue, we will set weight to 1 every time, because 
it
             // is possible new labels added to the parent.
             if (((AbstractCSQueue) queue).isDynamicQueue()) {
               if (queue.getQueueCapacities().getWeight(nodeLabel) == -1f) {
                 queue.getQueueCapacities().setWeight(nodeLabel, 1f);
               }
             }
           }
         }
   ```



-- 
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]

Reply via email to