YARN-6764. Simplify the logic in FairScheduler#attemptScheduling. Contributed by Yufei Gu.

This commit is contained in:
Yufei Gu 2017-07-09 16:08:37 -07:00
parent ba5b056e8a
commit 3de47ab5ea
1 changed files with 4 additions and 7 deletions

View File

@ -1046,16 +1046,13 @@ public class FairScheduler extends
Resource maxResourcesToAssign = Resources.multiply(
node.getUnallocatedResource(), 0.5f);
while (node.getReservedContainer() == null) {
boolean assignedContainer = false;
Resource assignment = queueMgr.getRootQueue().assignContainer(node);
if (!assignment.equals(Resources.none())) {
assignedContainers++;
assignedContainer = true;
Resources.addTo(assignedResource, assignment);
}
if (!assignedContainer) {
if (assignment.equals(Resources.none())) {
break;
}
assignedContainers++;
Resources.addTo(assignedResource, assignment);
if (!shouldContinueAssigning(assignedContainers, maxResourcesToAssign,
assignedResource)) {
break;