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,21 +518,27 @@ public abstract class AbstractCSQueue implements CSQueue {
|
|||||||
|
|
||||||
CapacityConfigType localType = CapacityConfigType.NONE;
|
CapacityConfigType localType = CapacityConfigType.NONE;
|
||||||
|
|
||||||
// TODO: revisit this later
|
if (queueContext.getConfiguration().isLegacyQueueMode()) {
|
||||||
// AbstractCSQueue.CapacityConfigType has only None, Percentage and Absolute mode
|
localType = checkConfigTypeIsAbsoluteResource(
|
||||||
final Set<QueueCapacityVector.ResourceUnitCapacityType> definedCapacityTypes =
|
getQueuePath(), label) ? CapacityConfigType.ABSOLUTE_RESOURCE
|
||||||
getConfiguredCapacityVector(label).getDefinedCapacityTypes();
|
: CapacityConfigType.PERCENTAGE;
|
||||||
if (definedCapacityTypes.size() == 1) {
|
} else {
|
||||||
QueueCapacityVector.ResourceUnitCapacityType next = definedCapacityTypes.iterator().next();
|
// TODO: revisit this later
|
||||||
if (Objects.requireNonNull(next) == PERCENTAGE) {
|
// AbstractCSQueue.CapacityConfigType has only None, Percentage and Absolute mode
|
||||||
localType = CapacityConfigType.PERCENTAGE;
|
final Set<QueueCapacityVector.ResourceUnitCapacityType> definedCapacityTypes =
|
||||||
} else if (next == QueueCapacityVector.ResourceUnitCapacityType.ABSOLUTE) {
|
getConfiguredCapacityVector(label).getDefinedCapacityTypes();
|
||||||
localType = CapacityConfigType.ABSOLUTE_RESOURCE;
|
if (definedCapacityTypes.size() == 1) {
|
||||||
} else if (next == WEIGHT) {
|
QueueCapacityVector.ResourceUnitCapacityType next = definedCapacityTypes.iterator().next();
|
||||||
|
if (Objects.requireNonNull(next) == PERCENTAGE) {
|
||||||
|
localType = CapacityConfigType.PERCENTAGE;
|
||||||
|
} else if (next == QueueCapacityVector.ResourceUnitCapacityType.ABSOLUTE) {
|
||||||
|
localType = CapacityConfigType.ABSOLUTE_RESOURCE;
|
||||||
|
} else if (next == WEIGHT) {
|
||||||
|
localType = CapacityConfigType.PERCENTAGE;
|
||||||
|
}
|
||||||
|
} else { // Mixed type
|
||||||
localType = CapacityConfigType.PERCENTAGE;
|
localType = CapacityConfigType.PERCENTAGE;
|
||||||
}
|
}
|
||||||
} else { // Mixed type
|
|
||||||
localType = CapacityConfigType.PERCENTAGE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.capacityConfigType.equals(CapacityConfigType.NONE)) {
|
if (this.capacityConfigType.equals(CapacityConfigType.NONE)) {
|
||||||
|
@ -70,19 +70,35 @@ public class CapacitySchedulerInfoHelper {
|
|||||||
private CapacitySchedulerInfoHelper() {}
|
private CapacitySchedulerInfoHelper() {}
|
||||||
|
|
||||||
public static String getMode(CSQueue queue) {
|
public static String getMode(CSQueue queue) {
|
||||||
final Set<QueueCapacityVector.ResourceUnitCapacityType> definedCapacityTypes =
|
if (((AbstractCSQueue) queue).getQueueContext().getConfiguration().isLegacyQueueMode()) {
|
||||||
queue.getConfiguredCapacityVector(NO_LABEL).getDefinedCapacityTypes();
|
if (queue.getCapacityConfigType() ==
|
||||||
if (definedCapacityTypes.size() == 1) {
|
AbstractCSQueue.CapacityConfigType.ABSOLUTE_RESOURCE) {
|
||||||
QueueCapacityVector.ResourceUnitCapacityType next = definedCapacityTypes.iterator().next();
|
|
||||||
if (Objects.requireNonNull(next) == PERCENTAGE) {
|
|
||||||
return "percentage";
|
|
||||||
} else if (next == QueueCapacityVector.ResourceUnitCapacityType.ABSOLUTE) {
|
|
||||||
return "absolute";
|
return "absolute";
|
||||||
} else if (next == QueueCapacityVector.ResourceUnitCapacityType.WEIGHT) {
|
} else if (queue.getCapacityConfigType() ==
|
||||||
return "weight";
|
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) {
|
||||||
|
QueueCapacityVector.ResourceUnitCapacityType next = definedCapacityTypes.iterator().next();
|
||||||
|
if (Objects.requireNonNull(next) == PERCENTAGE) {
|
||||||
|
return "percentage";
|
||||||
|
} else if (next == QueueCapacityVector.ResourceUnitCapacityType.ABSOLUTE) {
|
||||||
|
return "absolute";
|
||||||
|
} else if (next == QueueCapacityVector.ResourceUnitCapacityType.WEIGHT) {
|
||||||
|
return "weight";
|
||||||
|
}
|
||||||
|
} else if (definedCapacityTypes.size() > 1) {
|
||||||
|
return "mixed";
|
||||||
}
|
}
|
||||||
} else if (definedCapacityTypes.size() > 1) {
|
|
||||||
return "mixed";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "unknown";
|
return "unknown";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user