YARN-10942. Move AbstractCSQueue fields to separate objects that are tracking usage. Contributed by Szilard Nemeth
This commit is contained in:
parent
2194b9714e
commit
025f97c8c2
|
@ -87,12 +87,10 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
volatile CSQueue parent;
|
volatile CSQueue parent;
|
||||||
final String queueName;
|
final String queueName;
|
||||||
private final String queuePath;
|
private final String queuePath;
|
||||||
volatile int numContainers;
|
|
||||||
|
|
||||||
final Resource minimumAllocation;
|
final Resource minimumAllocation;
|
||||||
volatile Resource maximumAllocation;
|
volatile Resource maximumAllocation;
|
||||||
private volatile QueueState state = null;
|
private volatile QueueState state = null;
|
||||||
final CSQueueMetrics metrics;
|
|
||||||
protected final PrivilegedEntity queueEntity;
|
protected final PrivilegedEntity queueEntity;
|
||||||
|
|
||||||
final ResourceCalculator resourceCalculator;
|
final ResourceCalculator resourceCalculator;
|
||||||
|
@ -107,16 +105,11 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
new HashMap<AccessType, AccessControlList>();
|
new HashMap<AccessType, AccessControlList>();
|
||||||
volatile boolean reservationsContinueLooking;
|
volatile boolean reservationsContinueLooking;
|
||||||
|
|
||||||
// Track resource usage-by-label like used-resource/pending-resource, etc.
|
|
||||||
volatile ResourceUsage queueUsage;
|
|
||||||
|
|
||||||
// Track capacities like
|
// Track capacities like
|
||||||
// used-capacity/abs-used-capacity/capacity/abs-capacity,
|
// used-capacity/abs-used-capacity/capacity/abs-capacity,
|
||||||
// etc.
|
// etc.
|
||||||
QueueCapacities queueCapacities;
|
QueueCapacities queueCapacities;
|
||||||
|
|
||||||
QueueResourceQuotas queueResourceQuotas;
|
|
||||||
|
|
||||||
// -1 indicates lifetime is disabled
|
// -1 indicates lifetime is disabled
|
||||||
private volatile long maxApplicationLifetime = -1;
|
private volatile long maxApplicationLifetime = -1;
|
||||||
|
|
||||||
|
@ -127,6 +120,8 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
private volatile boolean defaultAppLifetimeWasSpecifiedInConfig = false;
|
private volatile boolean defaultAppLifetimeWasSpecifiedInConfig = false;
|
||||||
private CSQueuePreemption preemptionSettings;
|
private CSQueuePreemption preemptionSettings;
|
||||||
|
|
||||||
|
CSQueueUsageTracker usageTracker;
|
||||||
|
|
||||||
public enum CapacityConfigType {
|
public enum CapacityConfigType {
|
||||||
// FIXME, from what I can see, Percentage mode can almost apply to weighted
|
// FIXME, from what I can see, Percentage mode can almost apply to weighted
|
||||||
// and percentage mode at the same time, there's only small area need to be
|
// and percentage mode at the same time, there's only small area need to be
|
||||||
|
@ -153,10 +148,6 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
// is it a dynamic queue?
|
// is it a dynamic queue?
|
||||||
private boolean dynamicQueue = false;
|
private boolean dynamicQueue = false;
|
||||||
|
|
||||||
// The timestamp of the last submitted application to this queue.
|
|
||||||
// Only applies to dynamic queues.
|
|
||||||
private long lastSubmittedTimestamp;
|
|
||||||
|
|
||||||
public AbstractCSQueue(CapacitySchedulerContext cs,
|
public AbstractCSQueue(CapacitySchedulerContext cs,
|
||||||
String queueName, CSQueue parent, CSQueue old) throws IOException {
|
String queueName, CSQueue parent, CSQueue old) throws IOException {
|
||||||
this(cs, cs.getConfiguration(), queueName, parent, old);
|
this(cs, cs.getConfiguration(), queueName, parent, old);
|
||||||
|
@ -175,24 +166,15 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
this.activitiesManager = cs.getActivitiesManager();
|
this.activitiesManager = cs.getActivitiesManager();
|
||||||
|
|
||||||
// must be called after parent and queueName is set
|
// must be called after parent and queueName is set
|
||||||
this.metrics = old != null ?
|
CSQueueMetrics metrics = old != null ?
|
||||||
(CSQueueMetrics) old.getMetrics() :
|
(CSQueueMetrics) old.getMetrics() :
|
||||||
CSQueueMetrics.forQueue(getQueuePath(), parent,
|
CSQueueMetrics.forQueue(getQueuePath(), parent,
|
||||||
cs.getConfiguration().getEnableUserMetrics(), configuration);
|
cs.getConfiguration().getEnableUserMetrics(), configuration);
|
||||||
|
usageTracker = new CSQueueUsageTracker(metrics);
|
||||||
this.csContext = cs;
|
this.csContext = cs;
|
||||||
this.minimumAllocation = csContext.getMinimumResourceCapability();
|
this.minimumAllocation = csContext.getMinimumResourceCapability();
|
||||||
|
|
||||||
// initialize ResourceUsage
|
|
||||||
queueUsage = new ResourceUsage();
|
|
||||||
queueEntity = new PrivilegedEntity(EntityType.QUEUE, getQueuePath());
|
queueEntity = new PrivilegedEntity(EntityType.QUEUE, getQueuePath());
|
||||||
|
|
||||||
// initialize QueueCapacities
|
|
||||||
queueCapacities = new QueueCapacities(parent == null);
|
queueCapacities = new QueueCapacities(parent == null);
|
||||||
|
|
||||||
// initialize queueResourceQuotas
|
|
||||||
queueResourceQuotas = new QueueResourceQuotas();
|
|
||||||
|
|
||||||
ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||||
readLock = lock.readLock();
|
readLock = lock.readLock();
|
||||||
writeLock = lock.writeLock();
|
writeLock = lock.writeLock();
|
||||||
|
@ -246,11 +228,11 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Resource getUsedResources() {
|
public Resource getUsedResources() {
|
||||||
return queueUsage.getUsed();
|
return usageTracker.getQueueUsage().getUsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNumContainers() {
|
public int getNumContainers() {
|
||||||
return numContainers;
|
return usageTracker.getNumContainers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -260,7 +242,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CSQueueMetrics getMetrics() {
|
public CSQueueMetrics getMetrics() {
|
||||||
return metrics;
|
return usageTracker.getMetrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -650,8 +632,8 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
+ " minResource={} and maxResource={}", getQueuePath(), minResource,
|
+ " minResource={} and maxResource={}", getQueuePath(), minResource,
|
||||||
maxResource);
|
maxResource);
|
||||||
|
|
||||||
queueResourceQuotas.setConfiguredMinResource(label, minResource);
|
usageTracker.getQueueResourceQuotas().setConfiguredMinResource(label, minResource);
|
||||||
queueResourceQuotas.setConfiguredMaxResource(label, maxResource);
|
usageTracker.getQueueResourceQuotas().setConfiguredMaxResource(label, maxResource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,6 +797,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
public Map<String, QueueConfigurations> getQueueConfigurations() {
|
public Map<String, QueueConfigurations> getQueueConfigurations() {
|
||||||
Map<String, QueueConfigurations> queueConfigurations = new HashMap<>();
|
Map<String, QueueConfigurations> queueConfigurations = new HashMap<>();
|
||||||
Set<String> nodeLabels = getNodeLabelsForQueue();
|
Set<String> nodeLabels = getNodeLabelsForQueue();
|
||||||
|
QueueResourceQuotas queueResourceQuotas = usageTracker.getQueueResourceQuotas();
|
||||||
for (String nodeLabel : nodeLabels) {
|
for (String nodeLabel : nodeLabels) {
|
||||||
QueueConfigurations queueConfiguration =
|
QueueConfigurations queueConfiguration =
|
||||||
recordFactory.newRecordInstance(QueueConfigurations.class);
|
recordFactory.newRecordInstance(QueueConfigurations.class);
|
||||||
|
@ -857,10 +840,8 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
Resource resource, String nodePartition) {
|
Resource resource, String nodePartition) {
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
try {
|
try {
|
||||||
queueUsage.incUsed(nodePartition, resource);
|
usageTracker.getQueueUsage().incUsed(nodePartition, resource);
|
||||||
|
usageTracker.increaseNumContainers();
|
||||||
++numContainers;
|
|
||||||
|
|
||||||
CSQueueUtils.updateQueueStatistics(resourceCalculator, clusterResource,
|
CSQueueUtils.updateQueueStatistics(resourceCalculator, clusterResource,
|
||||||
this, labelManager, nodePartition);
|
this, labelManager, nodePartition);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -872,12 +853,12 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
Resource resource, String nodePartition) {
|
Resource resource, String nodePartition) {
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
try {
|
try {
|
||||||
queueUsage.decUsed(nodePartition, resource);
|
usageTracker.getQueueUsage().decUsed(nodePartition, resource);
|
||||||
|
|
||||||
CSQueueUtils.updateQueueStatistics(resourceCalculator, clusterResource,
|
CSQueueUtils.updateQueueStatistics(resourceCalculator, clusterResource,
|
||||||
this, labelManager, nodePartition);
|
this, labelManager, nodePartition);
|
||||||
|
|
||||||
--numContainers;
|
usageTracker.decreaseNumContainers();
|
||||||
} finally {
|
} finally {
|
||||||
writeLock.unlock();
|
writeLock.unlock();
|
||||||
}
|
}
|
||||||
|
@ -921,12 +902,12 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
|
|
||||||
@Private
|
@Private
|
||||||
public ResourceUsage getQueueResourceUsage() {
|
public ResourceUsage getQueueResourceUsage() {
|
||||||
return queueUsage;
|
return usageTracker.getQueueUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueueResourceQuotas getQueueResourceQuotas() {
|
public QueueResourceQuotas getQueueResourceQuotas() {
|
||||||
return queueResourceQuotas;
|
return usageTracker.getQueueResourceQuotas();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1056,7 +1037,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
Resource currentLimitResource = getCurrentLimitResource(nodePartition,
|
Resource currentLimitResource = getCurrentLimitResource(nodePartition,
|
||||||
clusterResource, currentResourceLimits, schedulingMode);
|
clusterResource, currentResourceLimits, schedulingMode);
|
||||||
|
|
||||||
Resource nowTotalUsed = queueUsage.getUsed(nodePartition);
|
Resource nowTotalUsed = usageTracker.getQueueUsage().getUsed(nodePartition);
|
||||||
|
|
||||||
// Set headroom for currentResourceLimits:
|
// Set headroom for currentResourceLimits:
|
||||||
// When queue is a parent queue: Headroom = limit - used + killable
|
// When queue is a parent queue: Headroom = limit - used + killable
|
||||||
|
@ -1088,7 +1069,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
newTotalWithoutReservedResource, currentLimitResource)) {
|
newTotalWithoutReservedResource, currentLimitResource)) {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("try to use reserved: " + getQueuePath()
|
LOG.debug("try to use reserved: " + getQueuePath()
|
||||||
+ " usedResources: " + queueUsage.getUsed()
|
+ " usedResources: " + usageTracker.getQueueUsage().getUsed()
|
||||||
+ ", clusterResources: " + clusterResource
|
+ ", clusterResources: " + clusterResource
|
||||||
+ ", reservedResources: " + resourceCouldBeUnreserved
|
+ ", reservedResources: " + resourceCouldBeUnreserved
|
||||||
+ ", capacity-without-reserved: "
|
+ ", capacity-without-reserved: "
|
||||||
|
@ -1103,7 +1084,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Failed to assign to queue: " + getQueuePath()
|
LOG.debug("Failed to assign to queue: " + getQueuePath()
|
||||||
+ " nodePartition: " + nodePartition
|
+ " nodePartition: " + nodePartition
|
||||||
+ ", usedResources: " + queueUsage.getUsed(nodePartition)
|
+ ", usedResources: " + usageTracker.getQueueUsage().getUsed(nodePartition)
|
||||||
+ ", clusterResources: " + clusterResource
|
+ ", clusterResources: " + clusterResource
|
||||||
+ ", reservedResources: " + resourceCouldBeUnreserved
|
+ ", reservedResources: " + resourceCouldBeUnreserved
|
||||||
+ ", maxLimitCapacity: " + currentLimitResource
|
+ ", maxLimitCapacity: " + currentLimitResource
|
||||||
|
@ -1114,11 +1095,11 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Check assign to queue: " + getQueuePath()
|
LOG.debug("Check assign to queue: " + getQueuePath()
|
||||||
+ " nodePartition: " + nodePartition
|
+ " nodePartition: " + nodePartition
|
||||||
+ ", usedResources: " + queueUsage.getUsed(nodePartition)
|
+ ", usedResources: " + usageTracker.getQueueUsage().getUsed(nodePartition)
|
||||||
+ ", clusterResources: " + clusterResource
|
+ ", clusterResources: " + clusterResource
|
||||||
+ ", currentUsedCapacity: " + Resources
|
+ ", currentUsedCapacity: " + Resources
|
||||||
.divide(resourceCalculator, clusterResource,
|
.divide(resourceCalculator, clusterResource,
|
||||||
queueUsage.getUsed(nodePartition), labelManager
|
usageTracker.getQueueUsage().getUsed(nodePartition), labelManager
|
||||||
.getResourceByLabel(nodePartition, clusterResource))
|
.getResourceByLabel(nodePartition, clusterResource))
|
||||||
+ ", max-capacity: " + queueCapacities
|
+ ", max-capacity: " + queueCapacities
|
||||||
.getAbsoluteMaximumCapacity(nodePartition));
|
.getAbsoluteMaximumCapacity(nodePartition));
|
||||||
|
@ -1162,39 +1143,39 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incReservedResource(String partition, Resource reservedRes) {
|
public void incReservedResource(String partition, Resource reservedRes) {
|
||||||
count(partition, reservedRes, queueUsage::incReserved,
|
count(partition, reservedRes, usageTracker.getQueueUsage()::incReserved,
|
||||||
parent == null ? null : parent::incReservedResource);
|
parent == null ? null : parent::incReservedResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decReservedResource(String partition, Resource reservedRes) {
|
public void decReservedResource(String partition, Resource reservedRes) {
|
||||||
count(partition, reservedRes, queueUsage::decReserved,
|
count(partition, reservedRes, usageTracker.getQueueUsage()::decReserved,
|
||||||
parent == null ? null : parent::decReservedResource);
|
parent == null ? null : parent::decReservedResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incPendingResource(String nodeLabel, Resource resourceToInc) {
|
public void incPendingResource(String nodeLabel, Resource resourceToInc) {
|
||||||
count(nodeLabel, resourceToInc, queueUsage::incPending,
|
count(nodeLabel, resourceToInc, usageTracker.getQueueUsage()::incPending,
|
||||||
parent == null ? null : parent::incPendingResource);
|
parent == null ? null : parent::incPendingResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decPendingResource(String nodeLabel, Resource resourceToDec) {
|
public void decPendingResource(String nodeLabel, Resource resourceToDec) {
|
||||||
count(nodeLabel, resourceToDec, queueUsage::decPending,
|
count(nodeLabel, resourceToDec, usageTracker.getQueueUsage()::decPending,
|
||||||
parent == null ? null : parent::decPendingResource);
|
parent == null ? null : parent::decPendingResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incUsedResource(String nodeLabel, Resource resourceToInc,
|
public void incUsedResource(String nodeLabel, Resource resourceToInc,
|
||||||
SchedulerApplicationAttempt application) {
|
SchedulerApplicationAttempt application) {
|
||||||
countAndUpdate(nodeLabel, resourceToInc, queueUsage::incUsed,
|
countAndUpdate(nodeLabel, resourceToInc, usageTracker.getQueueUsage()::incUsed,
|
||||||
parent == null ? null : parent::incUsedResource);
|
parent == null ? null : parent::incUsedResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decUsedResource(String nodeLabel, Resource resourceToDec,
|
public void decUsedResource(String nodeLabel, Resource resourceToDec,
|
||||||
SchedulerApplicationAttempt application) {
|
SchedulerApplicationAttempt application) {
|
||||||
countAndUpdate(nodeLabel, resourceToDec, queueUsage::decUsed,
|
countAndUpdate(nodeLabel, resourceToDec, usageTracker.getQueueUsage()::decUsed,
|
||||||
parent == null ? null : parent::decUsedResource);
|
parent == null ? null : parent::decUsedResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1205,7 +1186,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
boolean hasPendingResourceRequest(String nodePartition,
|
boolean hasPendingResourceRequest(String nodePartition,
|
||||||
Resource cluster, SchedulingMode schedulingMode) {
|
Resource cluster, SchedulingMode schedulingMode) {
|
||||||
return SchedulerUtils.hasPendingResourceRequest(resourceCalculator,
|
return SchedulerUtils.hasPendingResourceRequest(resourceCalculator,
|
||||||
queueUsage, nodePartition, cluster, schedulingMode);
|
usageTracker.getQueueUsage(), nodePartition, cluster, schedulingMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accessibleToPartition(String nodePartition) {
|
public boolean accessibleToPartition(String nodePartition) {
|
||||||
|
@ -1304,10 +1285,10 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
schedulerContainer.getNodePartition(), cluster);
|
schedulerContainer.getNodePartition(), cluster);
|
||||||
}
|
}
|
||||||
if (!Resources.fitsIn(resourceCalculator,
|
if (!Resources.fitsIn(resourceCalculator,
|
||||||
Resources.add(queueUsage.getUsed(partition), netAllocated),
|
Resources.add(usageTracker.getQueueUsage().getUsed(partition), netAllocated),
|
||||||
maxResourceLimit)) {
|
maxResourceLimit)) {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Used resource=" + queueUsage.getUsed(partition)
|
LOG.debug("Used resource=" + usageTracker.getQueueUsage().getUsed(partition)
|
||||||
+ " exceeded maxResourceLimit of the queue ="
|
+ " exceeded maxResourceLimit of the queue ="
|
||||||
+ maxResourceLimit);
|
+ maxResourceLimit);
|
||||||
}
|
}
|
||||||
|
@ -1534,7 +1515,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
// and the recently changed queue minResources.
|
// and the recently changed queue minResources.
|
||||||
// capacity = effectiveMinResource / {parent's effectiveMinResource}
|
// capacity = effectiveMinResource / {parent's effectiveMinResource}
|
||||||
float result = resourceCalculator.divide(clusterResource,
|
float result = resourceCalculator.divide(clusterResource,
|
||||||
queueResourceQuotas.getEffectiveMinResource(label),
|
usageTracker.getQueueResourceQuotas().getEffectiveMinResource(label),
|
||||||
parent.getQueueResourceQuotas().getEffectiveMinResource(label));
|
parent.getQueueResourceQuotas().getEffectiveMinResource(label));
|
||||||
queueCapacities.setCapacity(label,
|
queueCapacities.setCapacity(label,
|
||||||
Float.isInfinite(result) ? 0 : result);
|
Float.isInfinite(result) ? 0 : result);
|
||||||
|
@ -1543,7 +1524,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
// and the recently changed queue maxResources.
|
// and the recently changed queue maxResources.
|
||||||
// maxCapacity = effectiveMaxResource / parent's effectiveMaxResource
|
// maxCapacity = effectiveMaxResource / parent's effectiveMaxResource
|
||||||
result = resourceCalculator.divide(clusterResource,
|
result = resourceCalculator.divide(clusterResource,
|
||||||
queueResourceQuotas.getEffectiveMaxResource(label),
|
usageTracker.getQueueResourceQuotas().getEffectiveMaxResource(label),
|
||||||
parent.getQueueResourceQuotas().getEffectiveMaxResource(label));
|
parent.getQueueResourceQuotas().getEffectiveMaxResource(label));
|
||||||
queueCapacities.setMaximumCapacity(label,
|
queueCapacities.setMaximumCapacity(label,
|
||||||
Float.isInfinite(result) ? 0 : result);
|
Float.isInfinite(result) ? 0 : result);
|
||||||
|
@ -1577,7 +1558,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
if (getCapacityConfigType().equals(
|
if (getCapacityConfigType().equals(
|
||||||
CapacityConfigType.ABSOLUTE_RESOURCE)) {
|
CapacityConfigType.ABSOLUTE_RESOURCE)) {
|
||||||
newEffectiveMinResource = createNormalizedMinResource(
|
newEffectiveMinResource = createNormalizedMinResource(
|
||||||
queueResourceQuotas.getConfiguredMinResource(label),
|
usageTracker.getQueueResourceQuotas().getConfiguredMinResource(label),
|
||||||
((ParentQueue) parent).getEffectiveMinRatioPerResource());
|
((ParentQueue) parent).getEffectiveMinRatioPerResource());
|
||||||
|
|
||||||
// Max resource of a queue should be the minimum of {parent's maxResources,
|
// Max resource of a queue should be the minimum of {parent's maxResources,
|
||||||
|
@ -1597,9 +1578,9 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the effective min
|
// Update the effective min
|
||||||
queueResourceQuotas.setEffectiveMinResource(label,
|
usageTracker.getQueueResourceQuotas().setEffectiveMinResource(label,
|
||||||
newEffectiveMinResource);
|
newEffectiveMinResource);
|
||||||
queueResourceQuotas.setEffectiveMaxResource(label,
|
usageTracker.getQueueResourceQuotas().setEffectiveMaxResource(label,
|
||||||
newEffectiveMaxResource);
|
newEffectiveMaxResource);
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
|
@ -1667,7 +1648,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
public void updateLastSubmittedTimeStamp() {
|
public void updateLastSubmittedTimeStamp() {
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
try {
|
try {
|
||||||
this.lastSubmittedTimestamp = Time.monotonicNow();
|
usageTracker.setLastSubmittedTimestamp(Time.monotonicNow());
|
||||||
} finally {
|
} finally {
|
||||||
writeLock.unlock();
|
writeLock.unlock();
|
||||||
}
|
}
|
||||||
|
@ -1677,7 +1658,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
readLock.lock();
|
readLock.lock();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return lastSubmittedTimestamp;
|
return usageTracker.getLastSubmittedTimestamp();
|
||||||
} finally {
|
} finally {
|
||||||
readLock.unlock();
|
readLock.unlock();
|
||||||
}
|
}
|
||||||
|
@ -1687,7 +1668,7 @@ public abstract class AbstractCSQueue implements CSQueue {
|
||||||
public void setLastSubmittedTimestamp(long lastSubmittedTimestamp) {
|
public void setLastSubmittedTimestamp(long lastSubmittedTimestamp) {
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
try {
|
try {
|
||||||
this.lastSubmittedTimestamp = lastSubmittedTimestamp;
|
usageTracker.setLastSubmittedTimestamp(lastSubmittedTimestamp);
|
||||||
} finally {
|
} finally {
|
||||||
writeLock.unlock();
|
writeLock.unlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity;
|
||||||
|
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueResourceQuotas;
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceUsage;
|
||||||
|
|
||||||
|
public class CSQueueUsageTracker {
|
||||||
|
private final CSQueueMetrics metrics;
|
||||||
|
private int numContainers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The timestamp of the last submitted application to this queue.
|
||||||
|
* Only applies to dynamic queues.
|
||||||
|
*/
|
||||||
|
private long lastSubmittedTimestamp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tracks resource usage by label like used-resource / pending-resource.
|
||||||
|
*/
|
||||||
|
private final ResourceUsage queueUsage;
|
||||||
|
|
||||||
|
private final QueueResourceQuotas queueResourceQuotas;
|
||||||
|
|
||||||
|
public CSQueueUsageTracker(CSQueueMetrics metrics) {
|
||||||
|
this.metrics = metrics;
|
||||||
|
this.queueUsage = new ResourceUsage();
|
||||||
|
this.queueResourceQuotas = new QueueResourceQuotas();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumContainers() {
|
||||||
|
return numContainers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void increaseNumContainers() {
|
||||||
|
numContainers++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void decreaseNumContainers() {
|
||||||
|
numContainers--;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CSQueueMetrics getMetrics() {
|
||||||
|
return metrics;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getLastSubmittedTimestamp() {
|
||||||
|
return lastSubmittedTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastSubmittedTimestamp(long lastSubmittedTimestamp) {
|
||||||
|
this.lastSubmittedTimestamp = lastSubmittedTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceUsage getQueueUsage() {
|
||||||
|
return queueUsage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QueueResourceQuotas getQueueResourceQuotas() {
|
||||||
|
return queueResourceQuotas;
|
||||||
|
}
|
||||||
|
}
|
|
@ -161,7 +161,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
super(cs, configuration, queueName, parent, old);
|
super(cs, configuration, queueName, parent, old);
|
||||||
setDynamicQueue(isDynamic);
|
setDynamicQueue(isDynamic);
|
||||||
|
|
||||||
this.usersManager = new UsersManager(metrics, this, labelManager, csContext,
|
this.usersManager = new UsersManager(usageTracker.getMetrics(), this, labelManager, csContext,
|
||||||
resourceCalculator);
|
resourceCalculator);
|
||||||
|
|
||||||
// One time initialization is enough since it is static ordering policy
|
// One time initialization is enough since it is static ordering policy
|
||||||
|
@ -299,7 +299,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
+ " [= (float)(maximumAllocationMemory - minimumAllocationMemory) / "
|
+ " [= (float)(maximumAllocationMemory - minimumAllocationMemory) / "
|
||||||
+ "maximumAllocationMemory ]" + "\n" + "maximumAllocation = "
|
+ "maximumAllocationMemory ]" + "\n" + "maximumAllocation = "
|
||||||
+ maximumAllocation + " [= configuredMaxAllocation ]" + "\n"
|
+ maximumAllocation + " [= configuredMaxAllocation ]" + "\n"
|
||||||
+ "numContainers = " + numContainers
|
+ "numContainers = " + usageTracker.getNumContainers()
|
||||||
+ " [= currentNumContainers ]" + "\n" + "state = " + getState()
|
+ " [= currentNumContainers ]" + "\n" + "state = " + getState()
|
||||||
+ " [= configuredState ]" + "\n" + "acls = " + aclsString
|
+ " [= configuredState ]" + "\n" + "acls = " + aclsString
|
||||||
+ " [= configuredAcls ]" + "\n"
|
+ " [= configuredAcls ]" + "\n"
|
||||||
|
@ -483,7 +483,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
try {
|
try {
|
||||||
return getQueuePath() + ": " + getCapacityOrWeightString()
|
return getQueuePath() + ": " + getCapacityOrWeightString()
|
||||||
+ ", " + "absoluteCapacity=" + queueCapacities.getAbsoluteCapacity()
|
+ ", " + "absoluteCapacity=" + queueCapacities.getAbsoluteCapacity()
|
||||||
+ ", " + "usedResources=" + queueUsage.getUsed() + ", "
|
+ ", " + "usedResources=" + usageTracker.getQueueUsage().getUsed() + ", "
|
||||||
+ "usedCapacity=" + getUsedCapacity() + ", " + "absoluteUsedCapacity="
|
+ "usedCapacity=" + getUsedCapacity() + ", " + "absoluteUsedCapacity="
|
||||||
+ getAbsoluteUsedCapacity() + ", " + "numApps=" + getNumApplications()
|
+ getAbsoluteUsedCapacity() + ", " + "numApps=" + getNumApplications()
|
||||||
+ ", " + "numContainers=" + getNumContainers() + ", "
|
+ ", " + "numContainers=" + getNumContainers() + ", "
|
||||||
|
@ -600,7 +600,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
if (!isMoveApp) {
|
if (!isMoveApp) {
|
||||||
boolean unmanagedAM = application.getAppSchedulingInfo() != null &&
|
boolean unmanagedAM = application.getAppSchedulingInfo() != null &&
|
||||||
application.getAppSchedulingInfo().isUnmanagedAM();
|
application.getAppSchedulingInfo().isUnmanagedAM();
|
||||||
metrics.submitAppAttempt(userName, unmanagedAM);
|
usageTracker.getMetrics().submitAppAttempt(userName, unmanagedAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
getParent().submitApplicationAttempt(application, userName);
|
getParent().submitApplicationAttempt(application, userName);
|
||||||
|
@ -674,11 +674,11 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Resource getAMResourceLimit() {
|
public Resource getAMResourceLimit() {
|
||||||
return queueUsage.getAMLimit();
|
return usageTracker.getQueueUsage().getAMLimit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Resource getAMResourceLimitPerPartition(String nodePartition) {
|
public Resource getAMResourceLimitPerPartition(String nodePartition) {
|
||||||
return queueUsage.getAMLimit(nodePartition);
|
return usageTracker.getQueueUsage().getAMLimit(nodePartition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@ -751,7 +751,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
Resources.min(resourceCalculator, lastClusterResource,
|
Resources.min(resourceCalculator, lastClusterResource,
|
||||||
preWeighteduserAMLimit,
|
preWeighteduserAMLimit,
|
||||||
Resources.clone(getAMResourceLimitPerPartition(nodePartition)));
|
Resources.clone(getAMResourceLimitPerPartition(nodePartition)));
|
||||||
queueUsage.setUserAMLimit(nodePartition, preWeighteduserAMLimit);
|
usageTracker.getQueueUsage().setUserAMLimit(nodePartition, preWeighteduserAMLimit);
|
||||||
|
|
||||||
LOG.debug("Effective user AM limit for \"{}\":{}. Effective weighted"
|
LOG.debug("Effective user AM limit for \"{}\":{}. Effective weighted"
|
||||||
+ " user AM limit: {}. User weight: {}", userName,
|
+ " user AM limit: {}. User weight: {}", userName,
|
||||||
|
@ -803,8 +803,8 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
resourceCalculator, queuePartitionUsableResource, amResourcePercent,
|
resourceCalculator, queuePartitionUsableResource, amResourcePercent,
|
||||||
minimumAllocation);
|
minimumAllocation);
|
||||||
|
|
||||||
metrics.setAMResouceLimit(nodePartition, amResouceLimit);
|
usageTracker.getMetrics().setAMResouceLimit(nodePartition, amResouceLimit);
|
||||||
queueUsage.setAMLimit(nodePartition, amResouceLimit);
|
usageTracker.getQueueUsage().setAMLimit(nodePartition, amResouceLimit);
|
||||||
LOG.debug("Queue: {}, node label : {}, queue partition resource : {},"
|
LOG.debug("Queue: {}, node label : {}, queue partition resource : {},"
|
||||||
+ " queue current limit : {}, queue partition usable resource : {},"
|
+ " queue current limit : {}, queue partition usable resource : {},"
|
||||||
+ " amResourceLimit : {}", getQueuePath(), nodePartition,
|
+ " amResourceLimit : {}", getQueuePath(), nodePartition,
|
||||||
|
@ -849,7 +849,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
// Check am resource limit.
|
// Check am resource limit.
|
||||||
Resource amIfStarted = Resources.add(
|
Resource amIfStarted = Resources.add(
|
||||||
application.getAMResource(partitionName),
|
application.getAMResource(partitionName),
|
||||||
queueUsage.getAMUsed(partitionName));
|
usageTracker.getQueueUsage().getAMUsed(partitionName));
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("application " + application.getId() + " AMResource "
|
LOG.debug("application " + application.getId() + " AMResource "
|
||||||
|
@ -863,7 +863,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
if (!resourceCalculator.fitsIn(amIfStarted, amLimit)) {
|
if (!resourceCalculator.fitsIn(amIfStarted, amLimit)) {
|
||||||
if (getNumActiveApplications() < 1 || (Resources.lessThanOrEqual(
|
if (getNumActiveApplications() < 1 || (Resources.lessThanOrEqual(
|
||||||
resourceCalculator, lastClusterResource,
|
resourceCalculator, lastClusterResource,
|
||||||
queueUsage.getAMUsed(partitionName), Resources.none()))) {
|
usageTracker.getQueueUsage().getAMUsed(partitionName), Resources.none()))) {
|
||||||
LOG.warn("maximum-am-resource-percent is insufficient to start a"
|
LOG.warn("maximum-am-resource-percent is insufficient to start a"
|
||||||
+ " single application in queue, it is likely set too low."
|
+ " single application in queue, it is likely set too low."
|
||||||
+ " skipping enforcement to allow at least one application"
|
+ " skipping enforcement to allow at least one application"
|
||||||
|
@ -895,7 +895,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
if (!resourceCalculator.fitsIn(userAmIfStarted, userAMLimit)) {
|
if (!resourceCalculator.fitsIn(userAmIfStarted, userAMLimit)) {
|
||||||
if (getNumActiveApplications() < 1 || (Resources.lessThanOrEqual(
|
if (getNumActiveApplications() < 1 || (Resources.lessThanOrEqual(
|
||||||
resourceCalculator, lastClusterResource,
|
resourceCalculator, lastClusterResource,
|
||||||
queueUsage.getAMUsed(partitionName), Resources.none()))) {
|
usageTracker.getQueueUsage().getAMUsed(partitionName), Resources.none()))) {
|
||||||
LOG.warn("maximum-am-resource-percent is insufficient to start a"
|
LOG.warn("maximum-am-resource-percent is insufficient to start a"
|
||||||
+ " single application in queue for user, it is likely set too"
|
+ " single application in queue for user, it is likely set too"
|
||||||
+ " low. skipping enforcement to allow at least one application"
|
+ " low. skipping enforcement to allow at least one application"
|
||||||
|
@ -913,14 +913,14 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
orderingPolicy.addSchedulableEntity(application);
|
orderingPolicy.addSchedulableEntity(application);
|
||||||
application.updateAMContainerDiagnostics(AMState.ACTIVATED, null);
|
application.updateAMContainerDiagnostics(AMState.ACTIVATED, null);
|
||||||
|
|
||||||
queueUsage.incAMUsed(partitionName,
|
usageTracker.getQueueUsage().incAMUsed(partitionName,
|
||||||
application.getAMResource(partitionName));
|
application.getAMResource(partitionName));
|
||||||
user.getResourceUsage().incAMUsed(partitionName,
|
user.getResourceUsage().incAMUsed(partitionName,
|
||||||
application.getAMResource(partitionName));
|
application.getAMResource(partitionName));
|
||||||
user.getResourceUsage().setAMLimit(partitionName, userAMLimit);
|
user.getResourceUsage().setAMLimit(partitionName, userAMLimit);
|
||||||
metrics.incAMUsed(partitionName, application.getUser(),
|
usageTracker.getMetrics().incAMUsed(partitionName, application.getUser(),
|
||||||
application.getAMResource(partitionName));
|
application.getAMResource(partitionName));
|
||||||
metrics.setAMResouceLimitForUser(partitionName,
|
usageTracker.getMetrics().setAMResouceLimitForUser(partitionName,
|
||||||
application.getUser(), userAMLimit);
|
application.getUser(), userAMLimit);
|
||||||
fsApp.remove();
|
fsApp.remove();
|
||||||
LOG.info("Application " + applicationId + " from user: " + application
|
LOG.info("Application " + applicationId + " from user: " + application
|
||||||
|
@ -1021,11 +1021,11 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
if (!wasActive) {
|
if (!wasActive) {
|
||||||
pendingOrderingPolicy.removeSchedulableEntity(application);
|
pendingOrderingPolicy.removeSchedulableEntity(application);
|
||||||
} else{
|
} else{
|
||||||
queueUsage.decAMUsed(partitionName,
|
usageTracker.getQueueUsage().decAMUsed(partitionName,
|
||||||
application.getAMResource(partitionName));
|
application.getAMResource(partitionName));
|
||||||
user.getResourceUsage().decAMUsed(partitionName,
|
user.getResourceUsage().decAMUsed(partitionName,
|
||||||
application.getAMResource(partitionName));
|
application.getAMResource(partitionName));
|
||||||
metrics.decAMUsed(partitionName, application.getUser(),
|
usageTracker.getMetrics().decAMUsed(partitionName, application.getUser(),
|
||||||
application.getAMResource(partitionName));
|
application.getAMResource(partitionName));
|
||||||
}
|
}
|
||||||
applicationAttemptMap.remove(application.getApplicationAttemptId());
|
applicationAttemptMap.remove(application.getApplicationAttemptId());
|
||||||
|
@ -1058,11 +1058,11 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
private void setPreemptionAllowed(ResourceLimits limits, String nodePartition) {
|
private void setPreemptionAllowed(ResourceLimits limits, String nodePartition) {
|
||||||
// Set preemption-allowed:
|
// Set preemption-allowed:
|
||||||
// For leaf queue, only under-utilized queue is allowed to preempt resources from other queues
|
// For leaf queue, only under-utilized queue is allowed to preempt resources from other queues
|
||||||
if (!queueResourceQuotas.getEffectiveMinResource(nodePartition)
|
if (!usageTracker.getQueueResourceQuotas().getEffectiveMinResource(nodePartition)
|
||||||
.equals(Resources.none())) {
|
.equals(Resources.none())) {
|
||||||
limits.setIsAllowPreemption(Resources.lessThan(resourceCalculator,
|
limits.setIsAllowPreemption(Resources.lessThan(resourceCalculator,
|
||||||
csContext.getClusterResource(), queueUsage.getUsed(nodePartition),
|
csContext.getClusterResource(), usageTracker.getQueueUsage().getUsed(nodePartition),
|
||||||
queueResourceQuotas.getEffectiveMinResource(nodePartition)));
|
usageTracker.getQueueResourceQuotas().getEffectiveMinResource(nodePartition)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1514,7 +1514,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
Resources.subtractNonNegative(userLimitResource,
|
Resources.subtractNonNegative(userLimitResource,
|
||||||
user.getUsed(partition)),
|
user.getUsed(partition)),
|
||||||
Resources.subtractNonNegative(currentPartitionResourceLimit,
|
Resources.subtractNonNegative(currentPartitionResourceLimit,
|
||||||
queueUsage.getUsed(partition)));
|
usageTracker.getQueueUsage().getUsed(partition)));
|
||||||
// Normalize it before return
|
// Normalize it before return
|
||||||
headroom =
|
headroom =
|
||||||
Resources.roundDown(resourceCalculator, headroom, minimumAllocation);
|
Resources.roundDown(resourceCalculator, headroom, minimumAllocation);
|
||||||
|
@ -1560,7 +1560,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
setQueueResourceLimitsInfo(clusterResource);
|
setQueueResourceLimitsInfo(clusterResource);
|
||||||
|
|
||||||
Resource headroom =
|
Resource headroom =
|
||||||
metrics.getUserMetrics(user) == null ? Resources.none() :
|
usageTracker.getMetrics().getUserMetrics(user) == null ? Resources.none() :
|
||||||
getHeadroom(queueUser, cachedResourceLimitsForHeadroom.getLimit(),
|
getHeadroom(queueUser, cachedResourceLimitsForHeadroom.getLimit(),
|
||||||
clusterResource, userLimit, nodePartition);
|
clusterResource, userLimit, nodePartition);
|
||||||
|
|
||||||
|
@ -1577,7 +1577,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
|
|
||||||
application.setHeadroomProvider(headroomProvider);
|
application.setHeadroomProvider(headroomProvider);
|
||||||
|
|
||||||
metrics.setAvailableResourcesToUser(nodePartition, user, headroom);
|
usageTracker.getMetrics().setAvailableResourcesToUser(nodePartition, user, headroom);
|
||||||
|
|
||||||
return userLimit;
|
return userLimit;
|
||||||
}
|
}
|
||||||
|
@ -1844,20 +1844,20 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
nodePartition, true);
|
nodePartition, true);
|
||||||
|
|
||||||
Resource partitionHeadroom = Resources.createResource(0, 0);
|
Resource partitionHeadroom = Resources.createResource(0, 0);
|
||||||
if (metrics.getUserMetrics(userName) != null) {
|
if (usageTracker.getMetrics().getUserMetrics(userName) != null) {
|
||||||
partitionHeadroom = getHeadroom(user,
|
partitionHeadroom = getHeadroom(user,
|
||||||
cachedResourceLimitsForHeadroom.getLimit(), clusterResource,
|
cachedResourceLimitsForHeadroom.getLimit(), clusterResource,
|
||||||
getResourceLimitForActiveUsers(userName, clusterResource,
|
getResourceLimitForActiveUsers(userName, clusterResource,
|
||||||
nodePartition, SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY),
|
nodePartition, SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY),
|
||||||
nodePartition);
|
nodePartition);
|
||||||
}
|
}
|
||||||
metrics.setAvailableResourcesToUser(nodePartition, userName,
|
usageTracker.getMetrics().setAvailableResourcesToUser(nodePartition, userName,
|
||||||
partitionHeadroom);
|
partitionHeadroom);
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug(getQueuePath() + " user=" + userName + " used="
|
LOG.debug(getQueuePath() + " user=" + userName + " used="
|
||||||
+ queueUsage.getUsed(nodePartition) + " numContainers="
|
+ usageTracker.getQueueUsage().getUsed(nodePartition) + " numContainers="
|
||||||
+ numContainers + " headroom = " + application.getHeadroom()
|
+ usageTracker.getNumContainers() + " headroom = " + application.getHeadroom()
|
||||||
+ " user-resources=" + user.getUsed());
|
+ " user-resources=" + user.getUsed());
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1892,20 +1892,20 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
nodePartition, false);
|
nodePartition, false);
|
||||||
|
|
||||||
Resource partitionHeadroom = Resources.createResource(0, 0);
|
Resource partitionHeadroom = Resources.createResource(0, 0);
|
||||||
if (metrics.getUserMetrics(userName) != null) {
|
if (usageTracker.getMetrics().getUserMetrics(userName) != null) {
|
||||||
partitionHeadroom = getHeadroom(user,
|
partitionHeadroom = getHeadroom(user,
|
||||||
cachedResourceLimitsForHeadroom.getLimit(), clusterResource,
|
cachedResourceLimitsForHeadroom.getLimit(), clusterResource,
|
||||||
getResourceLimitForActiveUsers(userName, clusterResource,
|
getResourceLimitForActiveUsers(userName, clusterResource,
|
||||||
nodePartition, SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY),
|
nodePartition, SchedulingMode.RESPECT_PARTITION_EXCLUSIVITY),
|
||||||
nodePartition);
|
nodePartition);
|
||||||
}
|
}
|
||||||
metrics.setAvailableResourcesToUser(nodePartition, userName,
|
usageTracker.getMetrics().setAvailableResourcesToUser(nodePartition, userName,
|
||||||
partitionHeadroom);
|
partitionHeadroom);
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug(
|
LOG.debug(
|
||||||
getQueuePath() + " used=" + queueUsage.getUsed() + " numContainers="
|
getQueuePath() + " used=" + usageTracker.getQueueUsage().getUsed() + " numContainers="
|
||||||
+ numContainers + " user=" + userName + " user-resources="
|
+ usageTracker.getNumContainers() + " user=" + userName + " user-resources="
|
||||||
+ user.getUsed());
|
+ user.getUsed());
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -2001,7 +2001,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
getUser(application.getUser()).getResourceUsage().incAMUsed(nodeLabel,
|
getUser(application.getUser()).getResourceUsage().incAMUsed(nodeLabel,
|
||||||
resourceToInc);
|
resourceToInc);
|
||||||
// ResourceUsage has its own lock, no addition lock needs here.
|
// ResourceUsage has its own lock, no addition lock needs here.
|
||||||
queueUsage.incAMUsed(nodeLabel, resourceToInc);
|
usageTracker.getQueueUsage().incAMUsed(nodeLabel, resourceToInc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void decAMUsedResource(String nodeLabel, Resource resourceToDec,
|
public void decAMUsedResource(String nodeLabel, Resource resourceToDec,
|
||||||
|
@ -2009,7 +2009,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
getUser(application.getUser()).getResourceUsage().decAMUsed(nodeLabel,
|
getUser(application.getUser()).getResourceUsage().decAMUsed(nodeLabel,
|
||||||
resourceToDec);
|
resourceToDec);
|
||||||
// ResourceUsage has its own lock, no addition lock needs here.
|
// ResourceUsage has its own lock, no addition lock needs here.
|
||||||
queueUsage.decAMUsed(nodeLabel, resourceToDec);
|
usageTracker.getQueueUsage().decAMUsed(nodeLabel, resourceToDec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2159,7 +2159,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
+ " resource=" + rmContainer.getContainer().getResource()
|
+ " resource=" + rmContainer.getContainer().getResource()
|
||||||
+ " queueMoveIn=" + this + " usedCapacity=" + getUsedCapacity()
|
+ " queueMoveIn=" + this + " usedCapacity=" + getUsedCapacity()
|
||||||
+ " absoluteUsedCapacity=" + getAbsoluteUsedCapacity() + " used="
|
+ " absoluteUsedCapacity=" + getAbsoluteUsedCapacity() + " used="
|
||||||
+ queueUsage.getUsed() + " cluster=" + clusterResource);
|
+ usageTracker.getQueueUsage().getUsed() + " cluster=" + clusterResource);
|
||||||
// Inform the parent queue
|
// Inform the parent queue
|
||||||
getParent().attachContainer(clusterResource, application, rmContainer);
|
getParent().attachContainer(clusterResource, application, rmContainer);
|
||||||
}
|
}
|
||||||
|
@ -2179,7 +2179,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
+ " resource=" + rmContainer.getContainer().getResource()
|
+ " resource=" + rmContainer.getContainer().getResource()
|
||||||
+ " queueMoveOut=" + this + " usedCapacity=" + getUsedCapacity()
|
+ " queueMoveOut=" + this + " usedCapacity=" + getUsedCapacity()
|
||||||
+ " absoluteUsedCapacity=" + getAbsoluteUsedCapacity() + " used="
|
+ " absoluteUsedCapacity=" + getAbsoluteUsedCapacity() + " used="
|
||||||
+ queueUsage.getUsed() + " cluster=" + clusterResource);
|
+ usageTracker.getQueueUsage().getUsed() + " cluster=" + clusterResource);
|
||||||
// Inform the parent queue
|
// Inform the parent queue
|
||||||
getParent().detachContainer(clusterResource, application, rmContainer);
|
getParent().detachContainer(clusterResource, application, rmContainer);
|
||||||
}
|
}
|
||||||
|
@ -2347,6 +2347,7 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
private void updateQueuePreemptionMetrics(RMContainer rmc) {
|
private void updateQueuePreemptionMetrics(RMContainer rmc) {
|
||||||
final long usedMillis = rmc.getFinishTime() - rmc.getCreationTime();
|
final long usedMillis = rmc.getFinishTime() - rmc.getCreationTime();
|
||||||
final long usedSeconds = usedMillis / DateUtils.MILLIS_PER_SECOND;
|
final long usedSeconds = usedMillis / DateUtils.MILLIS_PER_SECOND;
|
||||||
|
CSQueueMetrics metrics = usageTracker.getMetrics();
|
||||||
Resource containerResource = rmc.getAllocatedResource();
|
Resource containerResource = rmc.getAllocatedResource();
|
||||||
metrics.preemptContainer();
|
metrics.preemptContainer();
|
||||||
long mbSeconds = (containerResource.getMemorySize() * usedMillis)
|
long mbSeconds = (containerResource.getMemorySize() * usedMillis)
|
||||||
|
|
|
@ -328,7 +328,7 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
Resource resourceByLabel = labelManager.getResourceByLabel(nodeLabel,
|
Resource resourceByLabel = labelManager.getResourceByLabel(nodeLabel,
|
||||||
scheduler.getClusterResource());
|
scheduler.getClusterResource());
|
||||||
Resource parentMinResource =
|
Resource parentMinResource =
|
||||||
queueResourceQuotas.getConfiguredMinResource(nodeLabel);
|
usageTracker.getQueueResourceQuotas().getConfiguredMinResource(nodeLabel);
|
||||||
if (!parentMinResource.equals(Resources.none()) && Resources.lessThan(
|
if (!parentMinResource.equals(Resources.none()) && Resources.lessThan(
|
||||||
resourceCalculator, resourceByLabel, parentMinResource, minRes)) {
|
resourceCalculator, resourceByLabel, parentMinResource, minRes)) {
|
||||||
throw new IOException(
|
throw new IOException(
|
||||||
|
@ -475,9 +475,9 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
"numChildQueue= " + childQueues.size() + ", " +
|
"numChildQueue= " + childQueues.size() + ", " +
|
||||||
getCapacityOrWeightString() + ", " +
|
getCapacityOrWeightString() + ", " +
|
||||||
"absoluteCapacity=" + queueCapacities.getAbsoluteCapacity() + ", " +
|
"absoluteCapacity=" + queueCapacities.getAbsoluteCapacity() + ", " +
|
||||||
"usedResources=" + queueUsage.getUsed() +
|
"usedResources=" + usageTracker.getQueueUsage().getUsed() +
|
||||||
"usedCapacity=" + getUsedCapacity() + ", " +
|
"usedCapacity=" + getUsedCapacity() + ", " +
|
||||||
"numApps=" + getNumApplications() + ", " +
|
"numApps=" + getNumApplications() + ", " +
|
||||||
"numContainers=" + getNumContainers();
|
"numContainers=" + getNumContainers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -992,7 +992,7 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
LOG.debug("assignedContainer reserved=" + isReserved + " queue="
|
LOG.debug("assignedContainer reserved=" + isReserved + " queue="
|
||||||
+ getQueuePath() + " usedCapacity=" + getUsedCapacity()
|
+ getQueuePath() + " usedCapacity=" + getUsedCapacity()
|
||||||
+ " absoluteUsedCapacity=" + getAbsoluteUsedCapacity() + " used="
|
+ " absoluteUsedCapacity=" + getAbsoluteUsedCapacity() + " used="
|
||||||
+ queueUsage.getUsed() + " cluster=" + clusterResource);
|
+ usageTracker.getQueueUsage().getUsed() + " cluster=" + clusterResource);
|
||||||
|
|
||||||
LOG.debug(
|
LOG.debug(
|
||||||
"ParentQ=" + getQueuePath() + " assignedSoFarInThisIteration="
|
"ParentQ=" + getQueuePath() + " assignedSoFarInThisIteration="
|
||||||
|
@ -1065,7 +1065,7 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
// First, cap parent limit by parent's max
|
// First, cap parent limit by parent's max
|
||||||
parentLimits.setLimit(Resources.min(resourceCalculator, clusterResource,
|
parentLimits.setLimit(Resources.min(resourceCalculator, clusterResource,
|
||||||
parentLimits.getLimit(),
|
parentLimits.getLimit(),
|
||||||
queueResourceQuotas.getEffectiveMaxResource(nodePartition)));
|
usageTracker.getQueueResourceQuotas().getEffectiveMaxResource(nodePartition)));
|
||||||
|
|
||||||
// Parent available resource = parent-limit - parent-used-resource
|
// Parent available resource = parent-limit - parent-used-resource
|
||||||
Resource limit = parentLimits.getLimit();
|
Resource limit = parentLimits.getLimit();
|
||||||
|
@ -1073,7 +1073,7 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
limit = parentLimits.getNetLimit();
|
limit = parentLimits.getNetLimit();
|
||||||
}
|
}
|
||||||
Resource parentMaxAvailableResource = Resources.subtract(
|
Resource parentMaxAvailableResource = Resources.subtract(
|
||||||
limit, queueUsage.getUsed(nodePartition));
|
limit, usageTracker.getQueueUsage().getUsed(nodePartition));
|
||||||
|
|
||||||
// Deduct killable from used
|
// Deduct killable from used
|
||||||
Resources.addTo(parentMaxAvailableResource,
|
Resources.addTo(parentMaxAvailableResource,
|
||||||
|
@ -1332,9 +1332,9 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Resources.lessThan(resourceCalculator, clusterResource,
|
if (Resources.lessThan(resourceCalculator, clusterResource,
|
||||||
queueResourceQuotas.getEffectiveMinResource(label),
|
usageTracker.getQueueResourceQuotas().getEffectiveMinResource(label),
|
||||||
configuredMinResources)) {
|
configuredMinResources)) {
|
||||||
numeratorForMinRatio = queueResourceQuotas
|
numeratorForMinRatio = usageTracker.getQueueResourceQuotas()
|
||||||
.getEffectiveMinResource(label);
|
.getEffectiveMinResource(label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1344,8 +1344,8 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
|
|
||||||
// Update effective resources for my self;
|
// Update effective resources for my self;
|
||||||
if (rootQueue) {
|
if (rootQueue) {
|
||||||
queueResourceQuotas.setEffectiveMinResource(label, resourceByLabel);
|
usageTracker.getQueueResourceQuotas().setEffectiveMinResource(label, resourceByLabel);
|
||||||
queueResourceQuotas.setEffectiveMaxResource(label, resourceByLabel);
|
usageTracker.getQueueResourceQuotas().setEffectiveMaxResource(label, resourceByLabel);
|
||||||
} else{
|
} else{
|
||||||
super.updateEffectiveResources(clusterResource);
|
super.updateEffectiveResources(clusterResource);
|
||||||
}
|
}
|
||||||
|
@ -1442,8 +1442,8 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
.getResource(), node.getPartition());
|
.getResource(), node.getPartition());
|
||||||
LOG.info("movedContainer" + " queueMoveIn=" + getQueuePath()
|
LOG.info("movedContainer" + " queueMoveIn=" + getQueuePath()
|
||||||
+ " usedCapacity=" + getUsedCapacity() + " absoluteUsedCapacity="
|
+ " usedCapacity=" + getUsedCapacity() + " absoluteUsedCapacity="
|
||||||
+ getAbsoluteUsedCapacity() + " used=" + queueUsage.getUsed() + " cluster="
|
+ getAbsoluteUsedCapacity() + " used=" + usageTracker.getQueueUsage().getUsed() +
|
||||||
+ clusterResource);
|
" cluster=" + clusterResource);
|
||||||
// Inform the parent
|
// Inform the parent
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.attachContainer(clusterResource, application, rmContainer);
|
parent.attachContainer(clusterResource, application, rmContainer);
|
||||||
|
@ -1462,8 +1462,8 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
node.getPartition());
|
node.getPartition());
|
||||||
LOG.info("movedContainer" + " queueMoveOut=" + getQueuePath()
|
LOG.info("movedContainer" + " queueMoveOut=" + getQueuePath()
|
||||||
+ " usedCapacity=" + getUsedCapacity() + " absoluteUsedCapacity="
|
+ " usedCapacity=" + getUsedCapacity() + " absoluteUsedCapacity="
|
||||||
+ getAbsoluteUsedCapacity() + " used=" + queueUsage.getUsed() + " cluster="
|
+ getAbsoluteUsedCapacity() + " used=" + usageTracker.getQueueUsage().getUsed() +
|
||||||
+ clusterResource);
|
" cluster=" + clusterResource);
|
||||||
// Inform the parent
|
// Inform the parent
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.detachContainer(clusterResource, application, rmContainer);
|
parent.detachContainer(clusterResource, application, rmContainer);
|
||||||
|
@ -1507,11 +1507,11 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
* When this happens, we have to preempt killable container (on same or different
|
* When this happens, we have to preempt killable container (on same or different
|
||||||
* nodes) of parent queue to avoid violating parent's max resource.
|
* nodes) of parent queue to avoid violating parent's max resource.
|
||||||
*/
|
*/
|
||||||
if (!queueResourceQuotas.getEffectiveMaxResource(nodePartition)
|
if (!usageTracker.getQueueResourceQuotas().getEffectiveMaxResource(nodePartition)
|
||||||
.equals(Resources.none())) {
|
.equals(Resources.none())) {
|
||||||
if (Resources.lessThan(resourceCalculator, clusterResource,
|
if (Resources.lessThan(resourceCalculator, clusterResource,
|
||||||
queueResourceQuotas.getEffectiveMaxResource(nodePartition),
|
usageTracker.getQueueResourceQuotas().getEffectiveMaxResource(nodePartition),
|
||||||
queueUsage.getUsed(nodePartition))) {
|
usageTracker.getQueueUsage().getUsed(nodePartition))) {
|
||||||
killContainersToEnforceMaxQueueCapacity(nodePartition,
|
killContainersToEnforceMaxQueueCapacity(nodePartition,
|
||||||
clusterResource);
|
clusterResource);
|
||||||
}
|
}
|
||||||
|
@ -1541,7 +1541,7 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
Resource maxResource = getEffectiveMaxCapacity(partition);
|
Resource maxResource = getEffectiveMaxCapacity(partition);
|
||||||
|
|
||||||
while (Resources.greaterThan(resourceCalculator, partitionResource,
|
while (Resources.greaterThan(resourceCalculator, partitionResource,
|
||||||
queueUsage.getUsed(partition), maxResource)) {
|
usageTracker.getQueueUsage().getUsed(partition), maxResource)) {
|
||||||
RMContainer toKillContainer = killableContainerIter.next();
|
RMContainer toKillContainer = killableContainerIter.next();
|
||||||
FiCaSchedulerApp attempt = csContext.getApplicationAttempt(
|
FiCaSchedulerApp attempt = csContext.getApplicationAttempt(
|
||||||
toKillContainer.getContainerId().getApplicationAttemptId());
|
toKillContainer.getContainerId().getApplicationAttemptId());
|
||||||
|
@ -1584,7 +1584,7 @@ public class ParentQueue extends AbstractCSQueue {
|
||||||
|
|
||||||
LOG.info("assignedContainer" + " queue=" + getQueuePath()
|
LOG.info("assignedContainer" + " queue=" + getQueuePath()
|
||||||
+ " usedCapacity=" + getUsedCapacity() + " absoluteUsedCapacity="
|
+ " usedCapacity=" + getUsedCapacity() + " absoluteUsedCapacity="
|
||||||
+ getAbsoluteUsedCapacity() + " used=" + queueUsage.getUsed()
|
+ getAbsoluteUsedCapacity() + " used=" + usageTracker.getQueueUsage().getUsed()
|
||||||
+ " cluster=" + cluster);
|
+ " cluster=" + cluster);
|
||||||
} finally {
|
} finally {
|
||||||
writeLock.unlock();
|
writeLock.unlock();
|
||||||
|
|
|
@ -222,13 +222,13 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
new ResourceLimits(cs.getClusterResource()));
|
new ResourceLimits(cs.getClusterResource()));
|
||||||
|
|
||||||
Assert.assertEquals(QUEUE_D_TEMPL_MINRES,
|
Assert.assertEquals(QUEUE_D_TEMPL_MINRES,
|
||||||
d1.queueResourceQuotas.getConfiguredMinResource());
|
d1.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals(QUEUE_D_TEMPL_MINRES,
|
Assert.assertEquals(QUEUE_D_TEMPL_MINRES,
|
||||||
d1.queueResourceQuotas.getEffectiveMinResource());
|
d1.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
||||||
d1.queueResourceQuotas.getConfiguredMaxResource());
|
d1.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
||||||
d1.queueResourceQuotas.getEffectiveMaxResource());
|
d1.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After adding child queue d2, d1 + d2 > resource
|
* After adding child queue d2, d1 + d2 > resource
|
||||||
|
@ -243,22 +243,22 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
new ResourceLimits(cs.getClusterResource()));
|
new ResourceLimits(cs.getClusterResource()));
|
||||||
|
|
||||||
Assert.assertEquals(Resource.newInstance(0, 0),
|
Assert.assertEquals(Resource.newInstance(0, 0),
|
||||||
d2.queueResourceQuotas.getConfiguredMinResource());
|
d2.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals(Resource.newInstance(0, 0),
|
Assert.assertEquals(Resource.newInstance(0, 0),
|
||||||
d2.queueResourceQuotas.getEffectiveMinResource());
|
d2.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
||||||
d2.queueResourceQuotas.getConfiguredMaxResource());
|
d2.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
||||||
d2.queueResourceQuotas.getEffectiveMaxResource());
|
d2.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
Assert.assertEquals(QUEUE_D_TEMPL_MINRES,
|
Assert.assertEquals(QUEUE_D_TEMPL_MINRES,
|
||||||
d1.queueResourceQuotas.getConfiguredMinResource());
|
d1.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals(QUEUE_D_TEMPL_MINRES,
|
Assert.assertEquals(QUEUE_D_TEMPL_MINRES,
|
||||||
d1.queueResourceQuotas.getEffectiveMinResource());
|
d1.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
||||||
d1.queueResourceQuotas.getConfiguredMaxResource());
|
d1.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
Assert.assertEquals(QUEUE_D_TEMPL_MAXRES,
|
||||||
d1.queueResourceQuotas.getEffectiveMaxResource());
|
d1.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
rm.close();
|
rm.close();
|
||||||
}
|
}
|
||||||
|
@ -287,35 +287,35 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
LeafQueue qA = (LeafQueue) cs.getQueue(QUEUEA);
|
LeafQueue qA = (LeafQueue) cs.getQueue(QUEUEA);
|
||||||
Assert.assertNotNull(qA);
|
Assert.assertNotNull(qA);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEA is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEA is not correct",
|
||||||
QUEUE_A_MINRES, qA.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_A_MINRES, qA.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEA is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEA is not correct",
|
||||||
QUEUE_A_MAXRES, qA.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_A_MAXRES, qA.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEA is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEA is not correct",
|
||||||
QUEUE_A_MINRES, qA.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_A_MINRES, qA.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEA is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEA is not correct",
|
||||||
QUEUE_A_MAXRES, qA.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_A_MAXRES, qA.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
LeafQueue qB = (LeafQueue) cs.getQueue(QUEUEB);
|
LeafQueue qB = (LeafQueue) cs.getQueue(QUEUEB);
|
||||||
Assert.assertNotNull(qB);
|
Assert.assertNotNull(qB);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEB is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEB is not correct",
|
||||||
QUEUE_B_MINRES, qB.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_B_MINRES, qB.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEB is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEB is not correct",
|
||||||
QUEUE_B_MAXRES, qB.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_B_MAXRES, qB.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEB is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEB is not correct",
|
||||||
QUEUE_B_MINRES, qB.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_B_MINRES, qB.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEB is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEB is not correct",
|
||||||
QUEUE_B_MAXRES, qB.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_B_MAXRES, qB.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
LeafQueue qC = (LeafQueue) cs.getQueue(QUEUEC);
|
LeafQueue qC = (LeafQueue) cs.getQueue(QUEUEC);
|
||||||
Assert.assertNotNull(qC);
|
Assert.assertNotNull(qC);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEC is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEC is not correct",
|
||||||
QUEUE_C_MINRES, qC.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_C_MINRES, qC.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEC is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEC is not correct",
|
||||||
QUEUE_C_MAXRES, qC.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_C_MAXRES, qC.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
||||||
QUEUE_C_MINRES, qC.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_C_MINRES, qC.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
||||||
QUEUE_C_MAXRES, qC.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_C_MAXRES, qC.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
rm.stop();
|
rm.stop();
|
||||||
}
|
}
|
||||||
|
@ -378,37 +378,37 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
|
|
||||||
LeafQueue qA1 = (LeafQueue) cs.getQueue(QUEUEA1);
|
LeafQueue qA1 = (LeafQueue) cs.getQueue(QUEUEA1);
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEA1 is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEA1 is not correct",
|
||||||
QUEUE_A1_MINRES, qA1.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_A1_MINRES, qA1.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEA1 is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEA1 is not correct",
|
||||||
QUEUE_A_MAXRES, qA1.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_A_MAXRES, qA1.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
LeafQueue qA2 = (LeafQueue) cs.getQueue(QUEUEA2);
|
LeafQueue qA2 = (LeafQueue) cs.getQueue(QUEUEA2);
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEA2 is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEA2 is not correct",
|
||||||
QUEUE_A2_MINRES, qA2.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_A2_MINRES, qA2.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEA2 is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEA2 is not correct",
|
||||||
QUEUE_A_MAXRES, qA2.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_A_MAXRES, qA2.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
LeafQueue qB1 = (LeafQueue) cs.getQueue(QUEUEB1);
|
LeafQueue qB1 = (LeafQueue) cs.getQueue(QUEUEB1);
|
||||||
Assert.assertNotNull(qB1);
|
Assert.assertNotNull(qB1);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEB1 is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEB1 is not correct",
|
||||||
QUEUE_B1_MINRES, qB1.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_B1_MINRES, qB1.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEB1 is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEB1 is not correct",
|
||||||
QUEUE_B_MAXRES, qB1.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_B_MAXRES, qB1.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEB1 is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEB1 is not correct",
|
||||||
QUEUE_B1_MINRES, qB1.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_B1_MINRES, qB1.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEB1 is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEB1 is not correct",
|
||||||
QUEUE_B_MAXRES, qB1.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_B_MAXRES, qB1.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
LeafQueue qC = (LeafQueue) cs.getQueue(QUEUEC);
|
LeafQueue qC = (LeafQueue) cs.getQueue(QUEUEC);
|
||||||
Assert.assertNotNull(qC);
|
Assert.assertNotNull(qC);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEC is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEC is not correct",
|
||||||
QUEUE_C_MINRES, qC.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_C_MINRES, qC.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEC is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEC is not correct",
|
||||||
QUEUE_C_MAXRES, qC.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_C_MAXRES, qC.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
||||||
QUEUE_C_MINRES, qC.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_C_MINRES, qC.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
||||||
QUEUE_C_MAXRES, qC.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_C_MAXRES, qC.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
// 3. Create a new config and make sure one queue's min resource is more
|
// 3. Create a new config and make sure one queue's min resource is more
|
||||||
// than its max resource configured.
|
// than its max resource configured.
|
||||||
|
@ -597,35 +597,35 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
LeafQueue qA = (LeafQueue) cs.getQueue(QUEUEA);
|
LeafQueue qA = (LeafQueue) cs.getQueue(QUEUEA);
|
||||||
Assert.assertNotNull(qA);
|
Assert.assertNotNull(qA);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEA is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEA is not correct",
|
||||||
QUEUE_A_MINRES, qA.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_A_MINRES, qA.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEA is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEA is not correct",
|
||||||
QUEUE_A_MAXRES, qA.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_A_MAXRES, qA.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEA is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEA is not correct",
|
||||||
QUEUE_A_MINRES, qA.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_A_MINRES, qA.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEA is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEA is not correct",
|
||||||
QUEUE_A_MAXRES, qA.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_A_MAXRES, qA.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
LeafQueue qB = (LeafQueue) cs.getQueue(QUEUEB);
|
LeafQueue qB = (LeafQueue) cs.getQueue(QUEUEB);
|
||||||
Assert.assertNotNull(qB);
|
Assert.assertNotNull(qB);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEB is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEB is not correct",
|
||||||
QUEUE_B_MINRES, qB.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_B_MINRES, qB.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEB is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEB is not correct",
|
||||||
QUEUE_B_MAXRES, qB.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_B_MAXRES, qB.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEB is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEB is not correct",
|
||||||
QUEUE_B_MINRES, qB.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_B_MINRES, qB.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEB is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEB is not correct",
|
||||||
QUEUE_B_MAXRES, qB.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_B_MAXRES, qB.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
LeafQueue qC = (LeafQueue) cs.getQueue(QUEUEC);
|
LeafQueue qC = (LeafQueue) cs.getQueue(QUEUEC);
|
||||||
Assert.assertNotNull(qC);
|
Assert.assertNotNull(qC);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEC is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEC is not correct",
|
||||||
QUEUE_C_MINRES, qC.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_C_MINRES, qC.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEC is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEC is not correct",
|
||||||
QUEUE_C_MAXRES, qC.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_C_MAXRES, qC.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
||||||
QUEUE_C_MINRES, qC.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_C_MINRES, qC.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
||||||
QUEUE_C_MAXRES, qC.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_C_MAXRES, qC.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
// unregister one NM.
|
// unregister one NM.
|
||||||
rm.unRegisterNode(nm1);
|
rm.unRegisterNode(nm1);
|
||||||
|
@ -634,19 +634,19 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
// above half. Hence A's min will be 60Gi and 6 cores and max will be
|
// above half. Hence A's min will be 60Gi and 6 cores and max will be
|
||||||
// 128GB and 20 cores.
|
// 128GB and 20 cores.
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEA is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEA is not correct",
|
||||||
QUEUEA_REDUCED, qA.queueResourceQuotas.getEffectiveMinResource());
|
QUEUEA_REDUCED, qA.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEA is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEA is not correct",
|
||||||
QUEUEMAX_REDUCED, qA.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUEMAX_REDUCED, qA.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEB is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEB is not correct",
|
||||||
QUEUEB_REDUCED, qB.queueResourceQuotas.getEffectiveMinResource());
|
QUEUEB_REDUCED, qB.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEB is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEB is not correct",
|
||||||
QUEUEMAX_REDUCED, qB.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUEMAX_REDUCED, qB.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
||||||
QUEUEC_REDUCED, qC.queueResourceQuotas.getEffectiveMinResource());
|
QUEUEC_REDUCED, qC.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
||||||
QUEUEMAX_REDUCED, qC.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUEMAX_REDUCED, qC.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
|
|
||||||
rm.stop();
|
rm.stop();
|
||||||
}
|
}
|
||||||
|
@ -676,13 +676,13 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
ParentQueue qA = (ParentQueue) cs.getQueue(QUEUEA);
|
ParentQueue qA = (ParentQueue) cs.getQueue(QUEUEA);
|
||||||
Assert.assertNotNull(qA);
|
Assert.assertNotNull(qA);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEA is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEA is not correct",
|
||||||
QUEUE_A_MINRES, qA.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_A_MINRES, qA.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEA is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEA is not correct",
|
||||||
QUEUE_A_MAXRES, qA.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_A_MAXRES, qA.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEA is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEA is not correct",
|
||||||
QUEUE_A_MINRES, qA.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_A_MINRES, qA.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEA is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEA is not correct",
|
||||||
QUEUE_A_MAXRES, qA.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_A_MAXRES, qA.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEA is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEA is not correct",
|
||||||
0.4, qA.getAbsoluteCapacity(), DELTA);
|
0.4, qA.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEA is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEA is not correct",
|
||||||
|
@ -691,13 +691,13 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
ParentQueue qB = (ParentQueue) cs.getQueue(QUEUEB);
|
ParentQueue qB = (ParentQueue) cs.getQueue(QUEUEB);
|
||||||
Assert.assertNotNull(qB);
|
Assert.assertNotNull(qB);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEB is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEB is not correct",
|
||||||
QUEUE_B_MINRES, qB.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_B_MINRES, qB.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEB is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEB is not correct",
|
||||||
QUEUE_B_MAXRES, qB.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_B_MAXRES, qB.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEB is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEB is not correct",
|
||||||
QUEUE_B_MINRES, qB.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_B_MINRES, qB.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEB is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEB is not correct",
|
||||||
QUEUE_B_MAXRES, qB.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_B_MAXRES, qB.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEB is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEB is not correct",
|
||||||
0.2, qB.getAbsoluteCapacity(), DELTA);
|
0.2, qB.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEB is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEB is not correct",
|
||||||
|
@ -706,13 +706,13 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
LeafQueue qC = (LeafQueue) cs.getQueue(QUEUEC);
|
LeafQueue qC = (LeafQueue) cs.getQueue(QUEUEC);
|
||||||
Assert.assertNotNull(qC);
|
Assert.assertNotNull(qC);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEC is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEC is not correct",
|
||||||
QUEUE_C_MINRES, qC.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_C_MINRES, qC.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEC is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEC is not correct",
|
||||||
QUEUE_C_MAXRES, qC.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_C_MAXRES, qC.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
||||||
QUEUE_C_MINRES, qC.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_C_MINRES, qC.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
||||||
QUEUE_C_MAXRES, qC.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_C_MAXRES, qC.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEC is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEC is not correct",
|
||||||
0.1, qC.getAbsoluteCapacity(), DELTA);
|
0.1, qC.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEC is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEC is not correct",
|
||||||
|
@ -720,9 +720,9 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
|
|
||||||
LeafQueue qA1 = (LeafQueue) cs.getQueue(QUEUEA1);
|
LeafQueue qA1 = (LeafQueue) cs.getQueue(QUEUEA1);
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEA1 is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEA1 is not correct",
|
||||||
QUEUE_A1_MINRES, qA1.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_A1_MINRES, qA1.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEA1 is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEA1 is not correct",
|
||||||
QUEUE_A_MAXRES, qA1.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_A_MAXRES, qA1.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEA1 is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEA1 is not correct",
|
||||||
0.2, qA1.getAbsoluteCapacity(), DELTA);
|
0.2, qA1.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEA1 is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEA1 is not correct",
|
||||||
|
@ -730,9 +730,9 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
|
|
||||||
LeafQueue qA2 = (LeafQueue) cs.getQueue(QUEUEA2);
|
LeafQueue qA2 = (LeafQueue) cs.getQueue(QUEUEA2);
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEA2 is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEA2 is not correct",
|
||||||
QUEUE_A2_MINRES, qA2.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_A2_MINRES, qA2.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEA2 is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEA2 is not correct",
|
||||||
QUEUE_A_MAXRES, qA2.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_A_MAXRES, qA2.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEA2 is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEA2 is not correct",
|
||||||
0.2, qA2.getAbsoluteCapacity(), DELTA);
|
0.2, qA2.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEA2 is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEA2 is not correct",
|
||||||
|
@ -740,13 +740,13 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
|
|
||||||
LeafQueue qB1 = (LeafQueue) cs.getQueue(QUEUEB1);
|
LeafQueue qB1 = (LeafQueue) cs.getQueue(QUEUEB1);
|
||||||
Assert.assertEquals("Min resource configured for QUEUEB1 is not correct",
|
Assert.assertEquals("Min resource configured for QUEUEB1 is not correct",
|
||||||
QUEUE_B1_MINRES, qB1.queueResourceQuotas.getConfiguredMinResource());
|
QUEUE_B1_MINRES, qB1.usageTracker.getQueueResourceQuotas().getConfiguredMinResource());
|
||||||
Assert.assertEquals("Max resource configured for QUEUEB1 is not correct",
|
Assert.assertEquals("Max resource configured for QUEUEB1 is not correct",
|
||||||
QUEUE_B_MAXRES, qB1.queueResourceQuotas.getConfiguredMaxResource());
|
QUEUE_B_MAXRES, qB1.usageTracker.getQueueResourceQuotas().getConfiguredMaxResource());
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEB1 is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEB1 is not correct",
|
||||||
QUEUE_B1_MINRES, qB1.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_B1_MINRES, qB1.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEB1 is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEB1 is not correct",
|
||||||
QUEUE_B_MAXRES, qB1.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_B_MAXRES, qB1.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEB1 is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEB1 is not correct",
|
||||||
0.16, qB1.getAbsoluteCapacity(), DELTA);
|
0.16, qB1.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEB1 is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEB1 is not correct",
|
||||||
|
@ -759,54 +759,54 @@ public class TestAbsoluteResourceConfiguration {
|
||||||
// Since configured capacity was based on initial node capacity, a
|
// Since configured capacity was based on initial node capacity, a
|
||||||
// re configurations is needed to use this added capacity.
|
// re configurations is needed to use this added capacity.
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEA is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEA is not correct",
|
||||||
QUEUE_A_MINRES, qA.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_A_MINRES, qA.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEA is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEA is not correct",
|
||||||
QUEUE_A_MAXRES, qA.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_A_MAXRES, qA.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEA is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEA is not correct",
|
||||||
0.266, qA.getAbsoluteCapacity(), DELTA);
|
0.266, qA.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEA is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEA is not correct",
|
||||||
0.533, qA.getAbsoluteMaximumCapacity(), DELTA);
|
0.533, qA.getAbsoluteMaximumCapacity(), DELTA);
|
||||||
|
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEB is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEB is not correct",
|
||||||
QUEUE_B_MINRES, qB.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_B_MINRES, qB.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEB is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEB is not correct",
|
||||||
QUEUE_B_MAXRES, qB.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_B_MAXRES, qB.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEB is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEB is not correct",
|
||||||
0.133, qB.getAbsoluteCapacity(), DELTA);
|
0.133, qB.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEB is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEB is not correct",
|
||||||
0.4, qB.getAbsoluteMaximumCapacity(), DELTA);
|
0.4, qB.getAbsoluteMaximumCapacity(), DELTA);
|
||||||
|
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEC is not correct",
|
||||||
QUEUE_C_MINRES, qC.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_C_MINRES, qC.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEC is not correct",
|
||||||
QUEUE_C_MAXRES, qC.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_C_MAXRES, qC.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEC is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEC is not correct",
|
||||||
0.066, qC.getAbsoluteCapacity(), DELTA);
|
0.066, qC.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEC is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEC is not correct",
|
||||||
0.4, qC.getAbsoluteMaximumCapacity(), DELTA);
|
0.4, qC.getAbsoluteMaximumCapacity(), DELTA);
|
||||||
|
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEB1 is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEB1 is not correct",
|
||||||
QUEUE_B1_MINRES, qB1.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_B1_MINRES, qB1.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEB1 is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEB1 is not correct",
|
||||||
QUEUE_B_MAXRES, qB1.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_B_MAXRES, qB1.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEB1 is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEB1 is not correct",
|
||||||
0.106, qB1.getAbsoluteCapacity(), DELTA);
|
0.106, qB1.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEB1 is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEB1 is not correct",
|
||||||
0.4, qB1.getAbsoluteMaximumCapacity(), DELTA);
|
0.4, qB1.getAbsoluteMaximumCapacity(), DELTA);
|
||||||
|
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEA1 is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEA1 is not correct",
|
||||||
QUEUE_A1_MINRES, qA1.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_A1_MINRES, qA1.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEA1 is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEA1 is not correct",
|
||||||
QUEUE_A_MAXRES, qA1.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_A_MAXRES, qA1.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEA1 is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEA1 is not correct",
|
||||||
0.133, qA1.getAbsoluteCapacity(), DELTA);
|
0.133, qA1.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEA1 is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEA1 is not correct",
|
||||||
0.533, qA1.getAbsoluteMaximumCapacity(), DELTA);
|
0.533, qA1.getAbsoluteMaximumCapacity(), DELTA);
|
||||||
|
|
||||||
Assert.assertEquals("Effective Min resource for QUEUEA2 is not correct",
|
Assert.assertEquals("Effective Min resource for QUEUEA2 is not correct",
|
||||||
QUEUE_A2_MINRES, qA2.queueResourceQuotas.getEffectiveMinResource());
|
QUEUE_A2_MINRES, qA2.usageTracker.getQueueResourceQuotas().getEffectiveMinResource());
|
||||||
Assert.assertEquals("Effective Max resource for QUEUEA2 is not correct",
|
Assert.assertEquals("Effective Max resource for QUEUEA2 is not correct",
|
||||||
QUEUE_A_MAXRES, qA2.queueResourceQuotas.getEffectiveMaxResource());
|
QUEUE_A_MAXRES, qA2.usageTracker.getQueueResourceQuotas().getEffectiveMaxResource());
|
||||||
Assert.assertEquals("Absolute capacity for QUEUEA2 is not correct",
|
Assert.assertEquals("Absolute capacity for QUEUEA2 is not correct",
|
||||||
0.133, qA2.getAbsoluteCapacity(), DELTA);
|
0.133, qA2.getAbsoluteCapacity(), DELTA);
|
||||||
Assert.assertEquals("Absolute Max capacity for QUEUEA2 is not correct",
|
Assert.assertEquals("Absolute Max capacity for QUEUEA2 is not correct",
|
||||||
|
|
Loading…
Reference in New Issue