brumi1024 commented on code in PR #8674:
URL: https://github.com/apache/hadoop/pull/8674#discussion_r3852336293


##########
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:
   For the legacy queue mode? Yes.  For the non-legacy one? We should show what 
is provided. And this logic omits any custom resources we might have:
   `capacityConfig = 
`[memory-mb=${configuredMinResource.memory},vcores=${configuredMinResource.vCores}]`;`
   
   It was a while ago I touched the UI, but I think there should already be a 
logic that parses and shows the resources from a resource object.



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