YARN-7414. FairScheduler#getAppWeight() should be moved into FSAppAttempt#getWeight()
(Contributed by Soumabrata Chakraborty via Daniel Templeton)
This commit is contained in:
parent
e094eb74b9
commit
b246c54749
@ -1304,7 +1304,20 @@ public Resource getResourceUsage() {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWeight() {
|
public float getWeight() {
|
||||||
return scheduler.getAppWeight(this);
|
double weight = 1.0;
|
||||||
|
|
||||||
|
if (scheduler.isSizeBasedWeight()) {
|
||||||
|
scheduler.getSchedulerReadLock().lock();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Set weight based on current memory demand
|
||||||
|
weight = Math.log1p(getDemand().getMemorySize()) / Math.log(2);
|
||||||
|
} finally {
|
||||||
|
scheduler.getSchedulerReadLock().unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (float)weight * this.getPriority().getPriority();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -368,21 +368,8 @@ public void update() {
|
|||||||
return rmContext.getContainerTokenSecretManager();
|
return rmContext.getContainerTokenSecretManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getAppWeight(FSAppAttempt app) {
|
public boolean isSizeBasedWeight() {
|
||||||
double weight = 1.0;
|
return sizeBasedWeight;
|
||||||
|
|
||||||
if (sizeBasedWeight) {
|
|
||||||
readLock.lock();
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Set weight based on current memory demand
|
|
||||||
weight = Math.log1p(app.getDemand().getMemorySize()) / Math.log(2);
|
|
||||||
} finally {
|
|
||||||
readLock.unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (float)weight * app.getPriority().getPriority();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Resource getIncrementResourceCapability() {
|
public Resource getIncrementResourceCapability() {
|
||||||
|
Loading…
Reference in New Issue
Block a user