YARN-2768. Avoid cloning Resource in FSAppAttempt#updateDemand. (Hong Zhiguo via kasha)
This commit is contained in:
parent
6f0a35724f
commit
5205a330b3
@ -378,6 +378,9 @@ Release 2.8.0 - UNRELEASED
|
|||||||
YARN-3259. FairScheduler: Trigger fairShare updates on node events.
|
YARN-3259. FairScheduler: Trigger fairShare updates on node events.
|
||||||
(Anubhav Dhoot via kasha)
|
(Anubhav Dhoot via kasha)
|
||||||
|
|
||||||
|
YARN-2768. Avoid cloning Resource in FSAppAttempt#updateDemand.
|
||||||
|
(Hong Zhiguo via kasha)
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
||||||
YARN-3197. Confusing log generated by CapacityScheduler. (Varun Saxena
|
YARN-3197. Confusing log generated by CapacityScheduler. (Varun Saxena
|
||||||
|
@ -151,6 +151,18 @@ public static Resource multiply(Resource lhs, double by) {
|
|||||||
return multiplyTo(clone(lhs), by);
|
return multiplyTo(clone(lhs), by);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiply @param rhs by @param by, and add the result to @param lhs
|
||||||
|
* without creating any new {@link Resource} object
|
||||||
|
*/
|
||||||
|
public static Resource multiplyAndAddTo(
|
||||||
|
Resource lhs, Resource rhs, double by) {
|
||||||
|
lhs.setMemory(lhs.getMemory() + (int)(rhs.getMemory() * by));
|
||||||
|
lhs.setVirtualCores(lhs.getVirtualCores()
|
||||||
|
+ (int)(rhs.getVirtualCores() * by));
|
||||||
|
return lhs;
|
||||||
|
}
|
||||||
|
|
||||||
public static Resource multiplyAndNormalizeUp(
|
public static Resource multiplyAndNormalizeUp(
|
||||||
ResourceCalculator calculator,Resource lhs, double by, Resource factor) {
|
ResourceCalculator calculator,Resource lhs, double by, Resource factor) {
|
||||||
return calculator.multiplyAndNormalizeUp(lhs, by, factor);
|
return calculator.multiplyAndNormalizeUp(lhs, by, factor);
|
||||||
|
@ -801,8 +801,8 @@ public void updateDemand() {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
for (Priority p : getPriorities()) {
|
for (Priority p : getPriorities()) {
|
||||||
for (ResourceRequest r : getResourceRequests(p).values()) {
|
for (ResourceRequest r : getResourceRequests(p).values()) {
|
||||||
Resource total = Resources.multiply(r.getCapability(), r.getNumContainers());
|
Resources.multiplyAndAddTo(demand,
|
||||||
Resources.addTo(demand, total);
|
r.getCapability(), r.getNumContainers());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user