|
@@ -542,6 +542,12 @@ public abstract class AbstractCSQueue implements CSQueue {
|
|
return maxResource;
|
|
return maxResource;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ protected boolean checkConfigTypeIsAbsoluteResource(String queuePath,
|
|
|
|
+ String label) {
|
|
|
|
+ return csContext.getConfiguration().checkConfigTypeIsAbsoluteResource(label,
|
|
|
|
+ queuePath, resourceTypes);
|
|
|
|
+ }
|
|
|
|
+
|
|
protected void updateConfigurableResourceRequirement(String queuePath,
|
|
protected void updateConfigurableResourceRequirement(String queuePath,
|
|
Resource clusterResource) {
|
|
Resource clusterResource) {
|
|
CapacitySchedulerConfiguration conf = csContext.getConfiguration();
|
|
CapacitySchedulerConfiguration conf = csContext.getConfiguration();
|
|
@@ -554,17 +560,18 @@ public abstract class AbstractCSQueue implements CSQueue {
|
|
LOG.debug("capacityConfigType is '{}' for queue {}",
|
|
LOG.debug("capacityConfigType is '{}' for queue {}",
|
|
capacityConfigType, getQueuePath());
|
|
capacityConfigType, getQueuePath());
|
|
|
|
|
|
|
|
+ CapacityConfigType localType = checkConfigTypeIsAbsoluteResource(
|
|
|
|
+ queuePath, label) ? CapacityConfigType.ABSOLUTE_RESOURCE
|
|
|
|
+ : CapacityConfigType.PERCENTAGE;
|
|
|
|
+
|
|
if (this.capacityConfigType.equals(CapacityConfigType.NONE)) {
|
|
if (this.capacityConfigType.equals(CapacityConfigType.NONE)) {
|
|
- this.capacityConfigType = (!minResource.equals(Resources.none())
|
|
|
|
- && queueCapacities.getAbsoluteCapacity(label) == 0f)
|
|
|
|
- ? CapacityConfigType.ABSOLUTE_RESOURCE
|
|
|
|
- : CapacityConfigType.PERCENTAGE;
|
|
|
|
|
|
+ this.capacityConfigType = localType;
|
|
LOG.debug("capacityConfigType is updated as '{}' for queue {}",
|
|
LOG.debug("capacityConfigType is updated as '{}' for queue {}",
|
|
capacityConfigType, getQueuePath());
|
|
capacityConfigType, getQueuePath());
|
|
|
|
+ } else {
|
|
|
|
+ validateAbsoluteVsPercentageCapacityConfig(localType);
|
|
}
|
|
}
|
|
|
|
|
|
- validateAbsoluteVsPercentageCapacityConfig(minResource);
|
|
|
|
-
|
|
|
|
// If min resource for a resource type is greater than its max resource,
|
|
// If min resource for a resource type is greater than its max resource,
|
|
// throw exception to handle such error configs.
|
|
// throw exception to handle such error configs.
|
|
if (!maxResource.equals(Resources.none()) && Resources.greaterThan(
|
|
if (!maxResource.equals(Resources.none()) && Resources.greaterThan(
|
|
@@ -607,12 +614,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
|
}
|
|
}
|
|
|
|
|
|
private void validateAbsoluteVsPercentageCapacityConfig(
|
|
private void validateAbsoluteVsPercentageCapacityConfig(
|
|
- Resource minResource) {
|
|
|
|
- CapacityConfigType localType = CapacityConfigType.PERCENTAGE;
|
|
|
|
- if (!minResource.equals(Resources.none())) {
|
|
|
|
- localType = CapacityConfigType.ABSOLUTE_RESOURCE;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ CapacityConfigType localType) {
|
|
if (!queuePath.equals("root")
|
|
if (!queuePath.equals("root")
|
|
&& !this.capacityConfigType.equals(localType)) {
|
|
&& !this.capacityConfigType.equals(localType)) {
|
|
throw new IllegalArgumentException("Queue '" + getQueuePath()
|
|
throw new IllegalArgumentException("Queue '" + getQueuePath()
|