brumi1024 commented on code in PR #8674:
URL: https://github.com/apache/hadoop/pull/8674#discussion_r3845787435
##########
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:
The scheduler REST response already provides
queueCapacityVectorInfo.configuredCapacityVector. Reconstructing the value from
weight, configuredMinResource, and the computed capacity is lossy. For example,
a valid mixed vector such as [memory-mb=16384,vcores=100%] has weight = -1 and
may have configuredMinResource = 0/0, so this code displays the computed scalar
capacity instead. It also drops custom resources (like GPU/FPGA/etc). Could we
type and use configuredCapacityVector directly?
The general idea is the less custom logic on the UI the better, we should
rely on the RM as much as possible, so that if something changes we don't need
to constantly update the UI logic as well.
##########
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;
Review Comment:
This seems a bit redundant, why do we need the isAutoCreatedLeafQueue check?
##########
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}]`;
+ } else if (configuredCapacity > 0) {
+ capacityConfig = String(configuredCapacity);
+ }
+ }
+
+ if (!maxCapacityDisplay.isStaged) {
+ const configuredMaxCapacity =
+ queueInfo.maxCapacity ?? defaultResourcePartition?.maxCapacity ?? 0;
+ const configuredMaxResource =
defaultResourcePartition?.configuredMaxResource;
+
+ if (
+ configuredMaxResource &&
+ (configuredMaxResource.memory > 0 || configuredMaxResource.vCores > 0)
+ ) {
+ maxCapacityConfig =
`[memory-mb=${configuredMaxResource.memory},vcores=${configuredMaxResource.vCores}]`;
Review Comment:
The same issue applies to maximum-capacity: non-legacy queue mode allows a
mixed capacity vector, but configuredMaxResource cannot preserve
percentage/weight components or custom resources.
--
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]