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

Alejandro Abdelnur commented on YARN-521:
-----------------------------------------

the checkLocalityRelaxationConflict() code is doing the same thing 3 times, for 
ANY, explicit-racks, implicit-racks.

how about changing it to 

{code}
  private void checkLocalityRelaxationConflict(Priority priority,
                                               Set<String> locations,
                                               boolean relaxLocality) {
    Map<String, TreeMap<Resource, ResourceRequestInfo>> remoteRequests =
      remoteRequestsTable.get(priority);
    if (remoteRequests != null) {
      for (String location : locations) {
        TreeMap<Resource, ResourceRequestInfo> reqs =
          remoteRequests.get(location);
        if (reqs != null && !reqs.isEmpty()
          && !reqs.values().iterator().next().remoteRequest.getRelaxLocality()) 
{
          throw new InvalidContainerRequestException("Cannot submit a"
            + " ContainerRequest explicitly asking for  '" + location
            + "' when it has already been filled in in a request with"
            + " locality relaxation turned off at the same priority");
        }
      }
    }    
  }
{code}

And then calling it 3 times, once with a set containing {{ANY}}, another with a 
set containing {{explicitRacks}} and a last time with a set containing 
{{implicitRacks-explicitRacks}}.

Other than that the patch looks good.


                
> Augment AM - RM client module to be able to request containers only at 
> specific locations
> -----------------------------------------------------------------------------------------
>
>                 Key: YARN-521
>                 URL: https://issues.apache.org/jira/browse/YARN-521
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: api
>    Affects Versions: 2.0.3-alpha
>            Reporter: Sandy Ryza
>            Assignee: Sandy Ryza
>         Attachments: YARN-521-1.patch, YARN-521.patch
>
>
> When YARN-392 and YARN-398 are completed, it would be good for AMRMClient to 
> offer an easy way to access their functionality

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to