[ https://issues.apache.org/jira/browse/YARN-5829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15941421#comment-15941421 ]
ASF GitHub Bot commented on YARN-5829: -------------------------------------- Github user kambatla commented on a diff in the pull request: https://github.com/apache/hadoop/pull/201#discussion_r108021362 --- Diff: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairScheduler.java --- @@ -968,6 +966,32 @@ private boolean shouldContinueAssigning(int containers, } } + /** + * Assign preempted containers to the applications that have reserved + * resources for preempted containers. + * @param node Node to check + * @return assignment has occurred + */ + static boolean assignPreemptedContainers(FSSchedulerNode node ) { + boolean assignedAny = false; + node.cleanupPreemptionList(); + for (Entry<FSAppAttempt, Resource> entry : + node.getPreemptionList().entrySet()) { + FSAppAttempt app = entry.getKey(); + Resource reserved = Resources.clone(entry.getValue()); + while (!app.isStopped() && !Resources.isNone(reserved)) { + Resource assigned = app.assignContainer(node); + if (Resources.isNone(assigned)) { + break; + } + assignedAny = true; + Resources.subtractFromNonNegative(reserved, assigned); + } + } + node.cleanupPreemptionList(); --- End diff -- Again, let us avoid cleaning up explicitly. > FS preemption should reserve a node before considering containers on it for > preemption > -------------------------------------------------------------------------------------- > > Key: YARN-5829 > URL: https://issues.apache.org/jira/browse/YARN-5829 > Project: Hadoop YARN > Issue Type: Sub-task > Components: fairscheduler > Reporter: Karthik Kambatla > Assignee: Miklos Szegedi > > FS preemption evaluates nodes for preemption, and subsequently preempts > identified containers. If this node is not reserved for a specific > application, any other application could be allocated resources on this node. > Reserving the node for the starved application before preempting containers > would help avoid this. -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org