YARN-6681. Eliminate double-copy of child queues in canAssignToThisQueue. Contributed by Daryn Sharp.
This commit is contained in:
parent
147df300bf
commit
fa1aaee87b
@ -22,6 +22,7 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
@ -615,6 +616,11 @@ Resource getQueueMaxResource(String nodePartition, Resource clusterResource) {
|
|||||||
minimumAllocation);
|
minimumAllocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasChildQueues() {
|
||||||
|
List<CSQueue> childQueues = getChildQueues();
|
||||||
|
return childQueues != null && !childQueues.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
boolean canAssignToThisQueue(Resource clusterResource,
|
boolean canAssignToThisQueue(Resource clusterResource,
|
||||||
String nodePartition, ResourceLimits currentResourceLimits,
|
String nodePartition, ResourceLimits currentResourceLimits,
|
||||||
Resource resourceCouldBeUnreserved, SchedulingMode schedulingMode) {
|
Resource resourceCouldBeUnreserved, SchedulingMode schedulingMode) {
|
||||||
@ -640,7 +646,7 @@ boolean canAssignToThisQueue(Resource clusterResource,
|
|||||||
// When queue is a parent queue: Headroom = limit - used + killable
|
// When queue is a parent queue: Headroom = limit - used + killable
|
||||||
// When queue is a leaf queue: Headroom = limit - used (leaf queue cannot preempt itself)
|
// When queue is a leaf queue: Headroom = limit - used (leaf queue cannot preempt itself)
|
||||||
Resource usedExceptKillable = nowTotalUsed;
|
Resource usedExceptKillable = nowTotalUsed;
|
||||||
if (null != getChildQueues() && !getChildQueues().isEmpty()) {
|
if (hasChildQueues()) {
|
||||||
usedExceptKillable = Resources.subtract(nowTotalUsed,
|
usedExceptKillable = Resources.subtract(nowTotalUsed,
|
||||||
getTotalKillableResource(nodePartition));
|
getTotalKillableResource(nodePartition));
|
||||||
}
|
}
|
||||||
|
@ -845,7 +845,12 @@ public void updateClusterResource(Resource clusterResource,
|
|||||||
writeLock.unlock();
|
writeLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasChildQueues() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CSQueue> getChildQueues() {
|
public List<CSQueue> getChildQueues() {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user