YARN-11533. CapacityScheduler CapacityConfigType changed in legacy queue allocation mode (#5852)

Co-authored-by: Benjamin Teke <bteke@cloudera.com>
This commit is contained in:
Benjamin Teke 2023-07-20 06:26:29 +02:00 committed by GitHub
parent 7ba2bd6305
commit 193ff1c24e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 24 deletions

View File

@ -518,6 +518,11 @@ public abstract class AbstractCSQueue implements CSQueue {
CapacityConfigType localType = CapacityConfigType.NONE;
if (queueContext.getConfiguration().isLegacyQueueMode()) {
localType = checkConfigTypeIsAbsoluteResource(
getQueuePath(), label) ? CapacityConfigType.ABSOLUTE_RESOURCE
: CapacityConfigType.PERCENTAGE;
} else {
// TODO: revisit this later
// AbstractCSQueue.CapacityConfigType has only None, Percentage and Absolute mode
final Set<QueueCapacityVector.ResourceUnitCapacityType> definedCapacityTypes =
@ -534,6 +539,7 @@ public abstract class AbstractCSQueue implements CSQueue {
} else { // Mixed type
localType = CapacityConfigType.PERCENTAGE;
}
}
if (this.capacityConfigType.equals(CapacityConfigType.NONE)) {
this.capacityConfigType = localType;

View File

@ -70,6 +70,21 @@ public class CapacitySchedulerInfoHelper {
private CapacitySchedulerInfoHelper() {}
public static String getMode(CSQueue queue) {
if (((AbstractCSQueue) queue).getQueueContext().getConfiguration().isLegacyQueueMode()) {
if (queue.getCapacityConfigType() ==
AbstractCSQueue.CapacityConfigType.ABSOLUTE_RESOURCE) {
return "absolute";
} else if (queue.getCapacityConfigType() ==
AbstractCSQueue.CapacityConfigType.PERCENTAGE) {
float weight = queue.getQueueCapacities().getWeight();
if (weight == -1) {
//-1 indicates we are not in weight mode
return "percentage";
} else {
return "weight";
}
}
} else {
final Set<QueueCapacityVector.ResourceUnitCapacityType> definedCapacityTypes =
queue.getConfiguredCapacityVector(NO_LABEL).getDefinedCapacityTypes();
if (definedCapacityTypes.size() == 1) {
@ -84,6 +99,7 @@ public class CapacitySchedulerInfoHelper {
} else if (definedCapacityTypes.size() > 1) {
return "mixed";
}
}
return "unknown";
}