|
@@ -331,20 +331,22 @@ public class FSLeafQueue extends FSQueue {
|
|
public void updateDemand() {
|
|
public void updateDemand() {
|
|
// Compute demand by iterating through apps in the queue
|
|
// Compute demand by iterating through apps in the queue
|
|
// Limit demand to maxResources
|
|
// Limit demand to maxResources
|
|
- demand = Resources.createResource(0);
|
|
|
|
|
|
+ Resource tmpDemand = Resources.createResource(0);
|
|
readLock.lock();
|
|
readLock.lock();
|
|
try {
|
|
try {
|
|
for (FSAppAttempt sched : runnableApps) {
|
|
for (FSAppAttempt sched : runnableApps) {
|
|
- updateDemandForApp(sched);
|
|
|
|
|
|
+ sched.updateDemand();
|
|
|
|
+ Resources.addTo(tmpDemand, sched.getDemand());
|
|
}
|
|
}
|
|
for (FSAppAttempt sched : nonRunnableApps) {
|
|
for (FSAppAttempt sched : nonRunnableApps) {
|
|
- updateDemandForApp(sched);
|
|
|
|
|
|
+ sched.updateDemand();
|
|
|
|
+ Resources.addTo(tmpDemand, sched.getDemand());
|
|
}
|
|
}
|
|
} finally {
|
|
} finally {
|
|
readLock.unlock();
|
|
readLock.unlock();
|
|
}
|
|
}
|
|
// Cap demand to maxShare to limit allocation to maxShare
|
|
// Cap demand to maxShare to limit allocation to maxShare
|
|
- demand = Resources.componentwiseMin(demand, maxShare);
|
|
|
|
|
|
+ demand = Resources.componentwiseMin(tmpDemand, maxShare);
|
|
if (LOG.isDebugEnabled()) {
|
|
if (LOG.isDebugEnabled()) {
|
|
LOG.debug("The updated demand for " + getName() + " is " + demand
|
|
LOG.debug("The updated demand for " + getName() + " is " + demand
|
|
+ "; the max is " + maxShare);
|
|
+ "; the max is " + maxShare);
|
|
@@ -352,17 +354,6 @@ public class FSLeafQueue extends FSQueue {
|
|
+ getFairShare());
|
|
+ getFairShare());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- private void updateDemandForApp(FSAppAttempt sched) {
|
|
|
|
- sched.updateDemand();
|
|
|
|
- Resource toAdd = sched.getDemand();
|
|
|
|
- if (LOG.isDebugEnabled()) {
|
|
|
|
- LOG.debug("Counting resource from " + sched.getName() + " " + toAdd
|
|
|
|
- + "; Total resource demand for " + getName() + " now "
|
|
|
|
- + demand);
|
|
|
|
- }
|
|
|
|
- demand = Resources.add(demand, toAdd);
|
|
|
|
- }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Resource assignContainer(FSSchedulerNode node) {
|
|
public Resource assignContainer(FSSchedulerNode node) {
|