[ 
https://issues.apache.org/jira/browse/YARN-5829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15923136#comment-15923136
 ] 

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_r105786285
  
    --- Diff: 
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSSchedulerNode.java
 ---
    @@ -18,30 +18,52 @@
     
     package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair;
     
    +import com.google.common.annotations.VisibleForTesting;
     import org.apache.commons.logging.Log;
     import org.apache.commons.logging.LogFactory;
     import org.apache.hadoop.classification.InterfaceAudience.Private;
     import org.apache.hadoop.classification.InterfaceStability.Unstable;
     import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
    +import org.apache.hadoop.yarn.api.records.ContainerId;
    +import org.apache.hadoop.yarn.api.records.Resource;
     import 
org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
     import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
     import 
org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt;
     import org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey;
     import 
org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode;
    +import org.apache.hadoop.yarn.util.resource.Resources;
     
     import java.util.Collection;
    +import java.util.Comparator;
    +import java.util.Iterator;
    +import java.util.LinkedHashMap;
    +import java.util.Map;
     import java.util.Set;
    -import java.util.concurrent.ConcurrentSkipListSet;
    +import java.util.concurrent.ConcurrentSkipListMap;
     
     @Private
     @Unstable
     public class FSSchedulerNode extends SchedulerNode {
     
       private static final Log LOG = LogFactory.getLog(FSSchedulerNode.class);
    -
    +  private static final Comparator<RMContainer> comparator =
    +      new Comparator<RMContainer>() {
    +    @Override
    +    public int compare(RMContainer o1, RMContainer o2) {
    +      return Long.compare(o1.getContainerId().getContainerId(),
    +          o2.getContainerId().getContainerId());
    +    }
    +  };
       private FSAppAttempt reservedAppSchedulable;
    -  private final Set<RMContainer> containersForPreemption =
    -      new ConcurrentSkipListSet<>();
    +  // Stores preemption list until the container is completed
    +  @VisibleForTesting
    +  final Map<RMContainer, FSAppAttempt> containersForPreemption =
    +      new ConcurrentSkipListMap<>(comparator);
    +
    +  // Stores preemption list after the container is completed before 
assigned
    +  @VisibleForTesting
    +  Map<FSAppAttempt, Resource> reservedApp =
    --- End diff --
    
    This map can be final as well. 


> 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

Reply via email to