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

ASF GitHub Bot commented on FLINK-5791:
---------------------------------------

Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3304#discussion_r102684171
  
    --- Diff: 
flink-yarn/src/main/java/org/apache/flink/yarn/YarnResourceManager.java ---
    @@ -376,4 +388,23 @@ private int generatePriority(ResourceProfile 
resourceProfile) {
                }
        }
     
    +   /**
    +    * Get resource profile by given the container priority. It should 
always be got from the mapping
    +    * between resource profile and priority, otherwise it will throw the 
exception.
    +    *
    +    * @param priority The container priority used for distinguishing 
different resources.
    +    * @return The resource profile corresponding with the priority.
    +    * @throws Exception
    +    */
    +   private ResourceProfile getResourceProfile(int priority) throws 
Exception{
    +           if (resourcePriorities.containsValue(priority)) {
    +                   for (Map.Entry<ResourceProfile, Integer> entry : 
resourcePriorities.entrySet()) {
    +                           if (entry.getValue() == priority) {
    +                                   return entry.getKey();
    +                           }
    +                   }
    +           }
    --- End diff --
    
    I think that is not the right way to query a map. If you have to traverse 
the whole map to find a value, then there is something wrong with the way you 
arrange your data.
    
    Could you explain me what the `resourcePriorities` actually does? To me it 
looks as if you use this to assign some kind of id to a yarn container which 
you then use to find out the mapping between the allocated container and the 
resource profile. That does not seem right at all. Priorities should tell the 
system how important it is to allocate a container.


> Resource should be strictly matched when allocating for yarn
> ------------------------------------------------------------
>
>                 Key: FLINK-5791
>                 URL: https://issues.apache.org/jira/browse/FLINK-5791
>             Project: Flink
>          Issue Type: Improvement
>          Components: YARN
>            Reporter: shuai.xu
>            Assignee: shuai.xu
>              Labels: flip-6
>
> In flip6, for yarn mode, resource should be assigned as requested to avoid 
> resource wasting and OOM.
> 1. YarnResourceManager will request container according to ResourceProfile   
> in slot request form JM.
> 2. RM will pass the ResourceProfile to TM for initializing its slots.
> 3. RM should match the slots offered by TM with SlotRequest from JM strictly.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to