YARN-11533. CapacityScheduler CapacityConfigType changed in legacy queue allocation mode (#5852)
Co-authored-by: Benjamin Teke <bteke@cloudera.com>
This commit is contained in:
parent
7ba2bd6305
commit
193ff1c24e
@ -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;
|
||||
|
@ -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";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user