当前位置: 首页>>代码示例>>Java>>正文


Java NodeType.RACK_LOCAL属性代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType.RACK_LOCAL属性的典型用法代码示例。如果您正苦于以下问题:Java NodeType.RACK_LOCAL属性的具体用法?Java NodeType.RACK_LOCAL怎么用?Java NodeType.RACK_LOCAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType的用法示例。


在下文中一共展示了NodeType.RACK_LOCAL属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMaxAllocatableContainers

private int getMaxAllocatableContainers(FiCaSchedulerApp application,
    Priority priority, FiCaSchedulerNode node, NodeType type) {
  int maxContainers = 0;
  
  ResourceRequest offSwitchRequest = 
    application.getResourceRequest(priority, ResourceRequest.ANY);
  if (offSwitchRequest != null) {
    maxContainers = offSwitchRequest.getNumContainers();
  }

  if (type == NodeType.OFF_SWITCH) {
    return maxContainers;
  }

  if (type == NodeType.RACK_LOCAL) {
    ResourceRequest rackLocalRequest = 
      application.getResourceRequest(priority, node.getRMNode().getRackName());
    if (rackLocalRequest == null) {
      return maxContainers;
    }

    maxContainers = Math.min(maxContainers, rackLocalRequest.getNumContainers());
  }

  if (type == NodeType.NODE_LOCAL) {
    ResourceRequest nodeLocalRequest = 
      application.getResourceRequest(priority, node.getRMNode().getNodeAddress());
    if (nodeLocalRequest != null) {
      maxContainers = Math.min(maxContainers, nodeLocalRequest.getNumContainers());
    }
  }

  return maxContainers;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:34,代码来源:FifoScheduler.java

示例2: canSchedule

public boolean canSchedule(NodeType type, String hostName) {
  if (type == NodeType.NODE_LOCAL) { 
    return hosts.contains(hostName);
  } else if (type == NodeType.RACK_LOCAL) {
    return racks.contains(Application.resolve(hostName));
  } 
  
  return true;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:Task.java

示例3: updateResourceRequests

private void updateResourceRequests(Map<String, ResourceRequest> requests, 
    NodeType type, Task task) {
  if (type == NodeType.NODE_LOCAL) {
    for (String host : task.getHosts()) {
      if(LOG.isDebugEnabled()) {
        LOG.debug("updateResourceRequests:" + " application=" + applicationId
          + " type=" + type + " host=" + host
          + " request=" + ((requests == null) ? "null" : requests.get(host)));
      }
      updateResourceRequest(requests.get(host));
    }
  }
  
  if (type == NodeType.NODE_LOCAL || type == NodeType.RACK_LOCAL) {
    for (String rack : task.getRacks()) {
      if(LOG.isDebugEnabled()) {
        LOG.debug("updateResourceRequests:" + " application=" + applicationId
          + " type=" + type + " rack=" + rack
          + " request=" + ((requests == null) ? "null" : requests.get(rack)));
      }
      updateResourceRequest(requests.get(rack));
    }
  }
  
  updateResourceRequest(requests.get(ResourceRequest.ANY));
  
  if(LOG.isDebugEnabled()) {
    LOG.debug("updateResourceRequests:" + " application=" + applicationId
      + " #asks=" + ask.size());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:Application.java

示例4: getMaxAllocatableContainers

private int getMaxAllocatableContainers(FiCaSchedulerApp application,
    Priority priority, FiCaSchedulerNode node, NodeType type) {
  ResourceRequest offSwitchRequest = 
    application.getResourceRequest(priority, ResourceRequest.ANY);
  int maxContainers = offSwitchRequest.getNumContainers();

  if (type == NodeType.OFF_SWITCH) {
    return maxContainers;
  }

  if (type == NodeType.RACK_LOCAL) {
    ResourceRequest rackLocalRequest = 
      application.getResourceRequest(priority, node.getRMNode().getRackName());
    if (rackLocalRequest == null) {
      return maxContainers;
    }

    maxContainers = Math.min(maxContainers, rackLocalRequest.getNumContainers());
  }

  if (type == NodeType.NODE_LOCAL) {
    ResourceRequest nodeLocalRequest = 
      application.getResourceRequest(priority, node.getRMNode().getNodeAddress());
    if (nodeLocalRequest != null) {
      maxContainers = Math.min(maxContainers, nodeLocalRequest.getNumContainers());
    }
  }

  return maxContainers;
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:30,代码来源:FifoScheduler.java

示例5: assignContainersOnNode

private ContainerAllocation assignContainersOnNode(Resource clusterResource,
    FiCaSchedulerNode node, Priority priority, RMContainer reservedContainer,
    SchedulingMode schedulingMode, ResourceLimits currentResoureLimits) {

  ContainerAllocation allocation;

  NodeType requestType = null;
  // Data-local
  ResourceRequest nodeLocalResourceRequest =
      application.getResourceRequest(priority, node.getNodeName());
  if (nodeLocalResourceRequest != null) {
    requestType = NodeType.NODE_LOCAL;
    allocation =
        assignNodeLocalContainers(clusterResource, nodeLocalResourceRequest,
            node, priority, reservedContainer, schedulingMode,
            currentResoureLimits);
    if (Resources.greaterThan(rc, clusterResource,
        allocation.getResourceToBeAllocated(), Resources.none())) {
      allocation.requestNodeType = requestType;
      return allocation;
    }
  }

  // Rack-local
  ResourceRequest rackLocalResourceRequest =
      application.getResourceRequest(priority, node.getRackName());
  if (rackLocalResourceRequest != null) {
    if (!rackLocalResourceRequest.getRelaxLocality()) {
      return ContainerAllocation.PRIORITY_SKIPPED;
    }

    if (requestType != NodeType.NODE_LOCAL) {
      requestType = NodeType.RACK_LOCAL;
    }

    allocation =
        assignRackLocalContainers(clusterResource, rackLocalResourceRequest,
            node, priority, reservedContainer, schedulingMode,
            currentResoureLimits);
    if (Resources.greaterThan(rc, clusterResource,
        allocation.getResourceToBeAllocated(), Resources.none())) {
      allocation.requestNodeType = requestType;
      return allocation;
    }
  }

  // Off-switch
  ResourceRequest offSwitchResourceRequest =
      application.getResourceRequest(priority, ResourceRequest.ANY);
  if (offSwitchResourceRequest != null) {
    if (!offSwitchResourceRequest.getRelaxLocality()) {
      return ContainerAllocation.PRIORITY_SKIPPED;
    }
    if (requestType != NodeType.NODE_LOCAL
        && requestType != NodeType.RACK_LOCAL) {
      requestType = NodeType.OFF_SWITCH;
    }

    allocation =
        assignOffSwitchContainers(clusterResource, offSwitchResourceRequest,
            node, priority, reservedContainer, schedulingMode,
            currentResoureLimits);
    allocation.requestNodeType = requestType;
    
    // When a returned allocation is LOCALITY_SKIPPED, since we're in
    // off-switch request now, we will skip this app w.r.t priorities 
    if (allocation.state == AllocationState.LOCALITY_SKIPPED) {
      allocation.state = AllocationState.APP_SKIPPED;
    }

    return allocation;
  }

  return ContainerAllocation.PRIORITY_SKIPPED;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:75,代码来源:RegularContainerAllocator.java

示例6: assignContainersOnNode

private CSAssignment assignContainersOnNode(Resource clusterResource,
    FiCaSchedulerNode node, FiCaSchedulerApp application, Priority priority,
    RMContainer reservedContainer, boolean needToUnreserve) {
  Resource assigned = Resources.none();

  // Data-local
  ResourceRequest nodeLocalResourceRequest =
      application.getResourceRequest(priority, node.getNodeName());
  if (nodeLocalResourceRequest != null) {
    assigned = 
        assignNodeLocalContainers(clusterResource, nodeLocalResourceRequest, 
            node, application, priority, reservedContainer, needToUnreserve); 
    if (Resources.greaterThan(resourceCalculator, clusterResource, 
        assigned, Resources.none())) {
      return new CSAssignment(assigned, NodeType.NODE_LOCAL);
    }
  }

  // Rack-local
  ResourceRequest rackLocalResourceRequest =
      application.getResourceRequest(priority, node.getRackName());
  if (rackLocalResourceRequest != null) {
    if (!rackLocalResourceRequest.getRelaxLocality()) {
      return SKIP_ASSIGNMENT;
    }
    
    assigned = 
        assignRackLocalContainers(clusterResource, rackLocalResourceRequest, 
            node, application, priority, reservedContainer, needToUnreserve);
    if (Resources.greaterThan(resourceCalculator, clusterResource, 
        assigned, Resources.none())) {
      return new CSAssignment(assigned, NodeType.RACK_LOCAL);
    }
  }
  
  // Off-switch
  ResourceRequest offSwitchResourceRequest =
      application.getResourceRequest(priority, ResourceRequest.ANY);
  if (offSwitchResourceRequest != null) {
    if (!offSwitchResourceRequest.getRelaxLocality()) {
      return SKIP_ASSIGNMENT;
    }

    return new CSAssignment(
        assignOffSwitchContainers(clusterResource, offSwitchResourceRequest,
            node, application, priority, reservedContainer, needToUnreserve), 
            NodeType.OFF_SWITCH);
  }
  
  return SKIP_ASSIGNMENT;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:51,代码来源:LeafQueue.java

示例7: assignContainersOnNode

private CSAssignment assignContainersOnNode(Resource clusterResource, 
    FiCaSchedulerNode node, FiCaSchedulerApp application, 
    Priority priority, RMContainer reservedContainer) {

  Resource assigned = Resources.none();

  // Data-local
  ResourceRequest nodeLocalResourceRequest =
      application.getResourceRequest(priority, node.getHostName());
  if (nodeLocalResourceRequest != null) {
    assigned = 
        assignNodeLocalContainers(clusterResource, nodeLocalResourceRequest, 
            node, application, priority, reservedContainer); 
    if (Resources.greaterThan(resourceCalculator, clusterResource, 
        assigned, Resources.none())) {
      return new CSAssignment(assigned, NodeType.NODE_LOCAL);
    }
  }

  // Rack-local
  ResourceRequest rackLocalResourceRequest =
      application.getResourceRequest(priority, node.getRackName());
  if (rackLocalResourceRequest != null) {
    if (!rackLocalResourceRequest.getRelaxLocality()) {
      return SKIP_ASSIGNMENT;
    }
    
    assigned = 
        assignRackLocalContainers(clusterResource, rackLocalResourceRequest, 
            node, application, priority, reservedContainer);
    if (Resources.greaterThan(resourceCalculator, clusterResource, 
        assigned, Resources.none())) {
      return new CSAssignment(assigned, NodeType.RACK_LOCAL);
    }
  }
  
  // Off-switch
  ResourceRequest offSwitchResourceRequest =
      application.getResourceRequest(priority, ResourceRequest.ANY);
  if (offSwitchResourceRequest != null) {
    if (!offSwitchResourceRequest.getRelaxLocality()) {
      return SKIP_ASSIGNMENT;
    }

    return new CSAssignment(
        assignOffSwitchContainers(clusterResource, offSwitchResourceRequest,
            node, application, priority, reservedContainer), 
            NodeType.OFF_SWITCH);
  }
  
  return SKIP_ASSIGNMENT;
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:52,代码来源:LeafQueue.java


注:本文中的org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType.RACK_LOCAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。