apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tweise <...@git.apache.org>
Subject [GitHub] incubator-apex-core pull request: APEXCORE-10 #resolve Changes for...
Date Sat, 26 Mar 2016 03:43:59 GMT
Github user tweise commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/250#discussion_r57508599
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/ResourceRequestHandler.java ---
    @@ -170,19 +205,69 @@ public String getHost(ContainerStartRequest csr, boolean first)
                 containers.add(nodeLocalOper.getContainer());
               }
             }
    -        for (Map.Entry<String, NodeReport> nodeEntry : nodeReportMap.entrySet())
{
    -          int memAvailable = nodeEntry.getValue().getCapability().getMemory() - nodeEntry.getValue().getUsed().getMemory();
    -          int vCoresAvailable = nodeEntry.getValue().getCapability().getVirtualCores()
- nodeEntry.getValue().getUsed().getVirtualCores();
    -          if (memAvailable >= aggrMemory && vCoresAvailable >= vCores)
{
    -            host = nodeEntry.getKey();
    -            grpObj.setHost(host);
    -            nodeLocalMapping.put(nodeLocalSet, host);
    -            return host;
    -          }
    +        host = assignHost(host, antiHosts, antiPreferredHosts, grpObj, nodeLocalSet,
aggrMemory, vCores);
    +
    +        if (host == null && !antiPreferredHosts.isEmpty() && !antiHosts.isEmpty())
{
    +          // Drop the preferred constraint and try allocation
    +          antiPreferredHosts.clear();
    +          host = assignHost(host, antiHosts, antiPreferredHosts, grpObj, nodeLocalSet,
aggrMemory, vCores);
    +        }
    +        if (host != null) {
    +          antiAffinityMapping.put(c, host);
    +        } else {
    +          host = INVALID_HOST;
             }
           }
         }
    +    LOG.info("Found host {}", host);
         return host;
       }
     
    +  public void populateAntiHostList(PTContainer c, List<String> antiHosts)
    +  {
    +    for (PTContainer container : c.getStrictAntiPrefs()) {
    +      if (antiAffinityMapping.containsKey(container)) {
    +        antiHosts.add(antiAffinityMapping.get(container));
    +      } else {
    +        // Check if there is an anti-affinity with host locality
    +        String antiHost = getAntiHostsList(container);
    +        if (antiHost != null) {
    +          antiHosts.add(antiHost);
    +        }
    +      }
    +    }
    +  }
    +
    +  public String getAntiHostsList(PTContainer container)
    --- End diff --
    
    javadoc


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message