Hean-Chhinling commented on code in PR #8674:
URL: https://github.com/apache/hadoop/pull/8674#discussion_r3851749652


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-capacity-scheduler-ui/src/main/webapp/src/features/queue-management/hooks/useQueueTreeData.ts:
##########
@@ -247,11 +247,59 @@ function getAutoCreationStatus(
 }
 
 function transformToCardData(queueInfo: QueueInfo, stagedChanges: 
StagedChange[]): QueueCardData {
-  const getQueuePropertyValue = 
useSchedulerStore.getState().getQueuePropertyValue;
+  const { getQueuePropertyValue, getQueuePartitionCapacities } = 
useSchedulerStore.getState();
 
   const capacityDisplay = getQueuePropertyValue(queueInfo.queuePath, 
'capacity');
   const maxCapacityDisplay = getQueuePropertyValue(queueInfo.queuePath, 
'maximum-capacity');
 
+  let capacityConfig = capacityDisplay.value;
+  let maxCapacityConfig = maxCapacityDisplay.value;
+
+  const isAutoCreatedQueue =
+    queueInfo.creationMethod === 'dynamicLegacy' ||
+    queueInfo.creationMethod === 'dynamicFlexible' ||
+    (queueInfo as { isAutoCreatedLeafQueue?: boolean }).isAutoCreatedLeafQueue 
=== true;
+
+  if (isAutoCreatedQueue) {
+    const defaultResourcePartition =
+      getQueuePartitionCapacities(queueInfo.queuePath, '') ??
+      queueInfo.capacities?.queueCapacitiesByPartition?.find((entry) => 
!entry.partitionName) ??
+      queueInfo.capacities?.queueCapacitiesByPartition?.[0];
+    const configuredMinResource = 
defaultResourcePartition?.configuredMinResource;
+
+    if (!capacityDisplay.isStaged) {
+      const configuredWeight = queueInfo.weight ?? 
defaultResourcePartition?.weight;
+      const configuredCapacity =
+        queueInfo.capacity ?? defaultResourcePartition?.capacity ?? 0;
+
+      if (configuredWeight !== undefined && configuredWeight > 0) {
+        capacityConfig = `${configuredWeight}w`;
+      } else if (
+        configuredMinResource &&
+        (configuredMinResource.memory > 0 || configuredMinResource.vCores > 0)
+      ) {
+        capacityConfig = 
`[memory-mb=${configuredMinResource.memory},vcores=${configuredMinResource.vCores}]`;

Review Comment:
   Thanks for actively reviewing the PR @brumi1024!
   I did not use `configuredCapacityVector`  intentionally because when I 
checked the /scheduler endpoint it shows as the following despite I configured 
the auto queue created capacity to (2048,2):
   ```
   <queueCapacityVectorInfo>
      
<configuredCapacityVector>[memory-mb=0.0%,vcores=0.0%]</configuredCapacityVector>
   </queueCapacityVectorInfo>
   ```
   
   And at `configuredMinResource` it shows correctly, therefore I used it 
instead:
   ```
   <configuredMinResource>
   <memory>2048</memory>
   <vCores>2</vCores>
   </configuredMinResource>
   ```
   
   Shouldn't the `configuredMinResource` is the right one here?



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