YARN-5185. StageAllocaterGreedyRLE: Fix NPE in corner case. (Carlo Curino via asuresh)
This commit is contained in:
parent
6de9213df1
commit
7a9b7372a1
@ -168,14 +168,22 @@ public Map<ReservationInterval, Resource> computeStageAllocation(Plan plan,
|
|||||||
if (allocateLeft) {
|
if (allocateLeft) {
|
||||||
// set earliest start to the min of the constraining "range" or my the
|
// set earliest start to the min of the constraining "range" or my the
|
||||||
// end of this allocation
|
// end of this allocation
|
||||||
|
if(partialMap.higherKey(minPoint) == null){
|
||||||
|
stageEarliestStart = stageEarliestStart + dur;
|
||||||
|
} else {
|
||||||
stageEarliestStart =
|
stageEarliestStart =
|
||||||
Math.min(partialMap.higherKey(minPoint), stageEarliestStart + dur);
|
Math.min(partialMap.higherKey(minPoint), stageEarliestStart + dur);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// same as above moving right-to-left
|
// same as above moving right-to-left
|
||||||
|
if(partialMap.higherKey(minPoint) == null){
|
||||||
|
stageDeadline = stageDeadline - dur;
|
||||||
|
} else {
|
||||||
stageDeadline =
|
stageDeadline =
|
||||||
Math.max(partialMap.higherKey(minPoint), stageDeadline - dur);
|
Math.max(partialMap.higherKey(minPoint), stageDeadline - dur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if no gangs are left to place we succeed and return the allocation
|
// if no gangs are left to place we succeed and return the allocation
|
||||||
if (gangsToPlace == 0) {
|
if (gangsToPlace == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user