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


Java NodeType.NODE_LOCAL属性代码示例

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


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

示例1: assignReservedContainer

private synchronized CSAssignment assignReservedContainer(
    FiCaSchedulerApp application, FiCaSchedulerNode node,
    RMContainer rmContainer, Resource clusterResource) {
  // Do we still need this reservation?
  Priority priority = rmContainer.getReservedPriority();
  if (application.getTotalRequiredResources(priority) == 0) {
    // Release
    return new CSAssignment(application, rmContainer);
  }

  // Try to assign if we have sufficient resources
  assignContainersOnNode(clusterResource, node, application, priority, 
      rmContainer, new ResourceLimits(Resources.none()));
  
  // Doesn't matter... since it's already charged for at time of reservation
  // "re-reservation" is *free*
  return new CSAssignment(Resources.none(), NodeType.NODE_LOCAL);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:LeafQueue.java

示例2: createReservedIncreasedCSAssignment

private CSAssignment createReservedIncreasedCSAssignment(
    SchedContainerChangeRequest request) {
  CSAssignment assignment =
      new CSAssignment(request.getDeltaCapacity(), NodeType.NODE_LOCAL, null,
          application, false, false);
  Resources.addTo(assignment.getAssignmentInformation().getReserved(),
      request.getDeltaCapacity());
  assignment.getAssignmentInformation().incrReservations();
  assignment.getAssignmentInformation().addReservationDetails(
      request.getContainerId(), application.getCSLeafQueue().getQueuePath());
  assignment.setIncreasedAllocation(true);
  
  LOG.info("Reserved increase container request:" + request.toString());
  
  return assignment;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:16,代码来源:IncreaseContainerAllocator.java

示例3: createSuccessfullyIncreasedCSAssignment

private CSAssignment createSuccessfullyIncreasedCSAssignment(
    SchedContainerChangeRequest request, boolean fromReservation) {
  CSAssignment assignment =
      new CSAssignment(request.getDeltaCapacity(), NodeType.NODE_LOCAL, null,
          application, false, fromReservation);
  Resources.addTo(assignment.getAssignmentInformation().getAllocated(),
      request.getDeltaCapacity());
  assignment.getAssignmentInformation().incrAllocations();
  assignment.getAssignmentInformation().addAllocationDetails(
      request.getContainerId(), application.getCSLeafQueue().getQueuePath());
  assignment.setIncreasedAllocation(true);
  
  // notify application
  application
      .getCSLeafQueue()
      .getOrderingPolicy()
      .containerAllocated(application,
          application.getRMContainer(request.getContainerId()));

  LOG.info("Approved increase container request:" + request.toString()
      + " fromReservation=" + fromReservation);    
  
  return assignment;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:IncreaseContainerAllocator.java

示例4: assignReservedContainer

private synchronized CSAssignment assignReservedContainer(
    FiCaSchedulerApp application, FiCaSchedulerNode node,
    RMContainer rmContainer, Resource clusterResource) {
  // Do we still need this reservation?
  Priority priority = rmContainer.getReservedPriority();
  //优先级是否已经达到要求以分配reservation 的 containers
  if (application.getTotalRequiredResources(priority) == 0) {
    // Release
    return new CSAssignment(application, rmContainer);
  }

  // Try to assign if we have sufficient resources
  assignContainersOnNode(clusterResource, node, application, priority, 
      rmContainer, new ResourceLimits(Resources.none()));
  
  // Doesn't matter... since it's already charged for at time of reservation
  // "re-reservation" is *free*
  return new CSAssignment(Resources.none(), NodeType.NODE_LOCAL);
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:19,代码来源:LeafQueue.java

示例5: assignReservedContainer

private synchronized CSAssignment 
assignReservedContainer(FiCaSchedulerApp application, 
    FiCaSchedulerNode node, RMContainer rmContainer, Resource clusterResource) {
  // Do we still need this reservation?
  Priority priority = rmContainer.getReservedPriority();
  if (application.getTotalRequiredResources(priority) == 0) {
    // Release
    return new CSAssignment(application, rmContainer);
  }

  // Try to assign if we have sufficient resources
  assignContainersOnNode(clusterResource, node, application, priority, 
      rmContainer, false);
  
  // Doesn't matter... since it's already charged for at time of reservation
  // "re-reservation" is *free*
  return new CSAssignment(Resources.none(), NodeType.NODE_LOCAL);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:18,代码来源:LeafQueue.java

示例6: createSuccessfullyIncreasedCSAssignment

private CSAssignment createSuccessfullyIncreasedCSAssignment(
    SchedContainerChangeRequest request, boolean fromReservation) {
  CSAssignment assignment =
      new CSAssignment(request.getDeltaCapacity(), NodeType.NODE_LOCAL, null,
          application, CSAssignment.SkippedType.NONE, fromReservation);
  Resources.addTo(assignment.getAssignmentInformation().getAllocated(),
      request.getDeltaCapacity());
  assignment.getAssignmentInformation().incrAllocations();
  assignment.getAssignmentInformation().addAllocationDetails(
      request.getContainerId(), application.getCSLeafQueue().getQueuePath());
  assignment.setIncreasedAllocation(true);
  
  // notify application
  application
      .getCSLeafQueue()
      .getOrderingPolicy()
      .containerAllocated(application,
          application.getRMContainer(request.getContainerId()));

  LOG.info("Approved increase container request:" + request.toString()
      + " fromReservation=" + fromReservation);    
  
  return assignment;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:24,代码来源:IncreaseContainerAllocator.java

示例7: 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

示例8: getAllowedLocalityLevel

/**
 * Return the level at which we are allowed to schedule containers, given the
 * current size of the cluster and thresholds indicating how many nodes to
 * fail at (as a fraction of cluster size) before relaxing scheduling
 * constraints.
 */
public synchronized NodeType getAllowedLocalityLevel(Priority priority,
    int numNodes, double nodeLocalityThreshold, double rackLocalityThreshold) {
  // upper limit on threshold
  if (nodeLocalityThreshold > 1.0) { nodeLocalityThreshold = 1.0; }
  if (rackLocalityThreshold > 1.0) { rackLocalityThreshold = 1.0; }

  // If delay scheduling is not being used, can schedule anywhere
  if (nodeLocalityThreshold < 0.0 || rackLocalityThreshold < 0.0) {
    return NodeType.OFF_SWITCH;
  }

  // Default level is NODE_LOCAL
  if (!allowedLocalityLevel.containsKey(priority)) {
    allowedLocalityLevel.put(priority, NodeType.NODE_LOCAL);
    return NodeType.NODE_LOCAL;
  }

  NodeType allowed = allowedLocalityLevel.get(priority);

  // If level is already most liberal, we're done
  if (allowed.equals(NodeType.OFF_SWITCH)) return NodeType.OFF_SWITCH;

  double threshold = allowed.equals(NodeType.NODE_LOCAL) ? nodeLocalityThreshold :
    rackLocalityThreshold;

  // Relax locality constraints once we've surpassed threshold.
  if (getSchedulingOpportunities(priority) > (numNodes * threshold)) {
    if (allowed.equals(NodeType.NODE_LOCAL)) {
      allowedLocalityLevel.put(priority, NodeType.RACK_LOCAL);
      resetSchedulingOpportunities(priority);
    }
    else if (allowed.equals(NodeType.RACK_LOCAL)) {
      allowedLocalityLevel.put(priority, NodeType.OFF_SWITCH);
      resetSchedulingOpportunities(priority);
    }
  }
  return allowedLocalityLevel.get(priority);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:44,代码来源:FSAppAttempt.java

示例9: CSAssignment

public CSAssignment(FiCaSchedulerApp application, RMContainer excessReservation) {
  this.resource = excessReservation.getContainer().getResource();
  this.type = NodeType.NODE_LOCAL;
  this.application = application;
  this.excessReservation = excessReservation;
  this.skipped = false;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:CSAssignment.java

示例10: 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

示例11: 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

示例12: assignContainersToChildQueues

private synchronized CSAssignment assignContainersToChildQueues(Resource cluster, 
    FiCaSchedulerNode node, boolean needToUnreserve) {
  CSAssignment assignment = 
      new CSAssignment(Resources.createResource(0, 0), NodeType.NODE_LOCAL);
  
  printChildQueues();

  // Try to assign to most 'under-served' sub-queue
  for (Iterator<CSQueue> iter=childQueues.iterator(); iter.hasNext();) {
    CSQueue childQueue = iter.next();
    if(LOG.isDebugEnabled()) {
      LOG.debug("Trying to assign to queue: " + childQueue.getQueuePath()
        + " stats: " + childQueue);
    }
    assignment = childQueue.assignContainers(cluster, node, needToUnreserve);
    if(LOG.isDebugEnabled()) {
      LOG.debug("Assigned to queue: " + childQueue.getQueuePath() +
        " stats: " + childQueue + " --> " + 
        assignment.getResource() + ", " + assignment.getType());
    }

    // If we do assign, remove the queue and re-insert in-order to re-sort
    if (Resources.greaterThan(
            resourceCalculator, cluster, 
            assignment.getResource(), Resources.none())) {
      // Remove and re-insert to sort
      iter.remove();
      LOG.info("Re-sorting assigned queue: " + childQueue.getQueuePath() + 
          " stats: " + childQueue);
      childQueues.add(childQueue);
      if (LOG.isDebugEnabled()) {
        printChildQueues();
      }
      break;
    }
  }
  
  return assignment;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:39,代码来源:ParentQueue.java

示例13: reservationExceedsThreshold

private boolean reservationExceedsThreshold(FSSchedulerNode node,
                                               NodeType type) {
  // Only if not node-local
  if (type != NodeType.NODE_LOCAL) {
    int existingReservations = getNumReservations(node.getRackName(),
            type == NodeType.OFF_SWITCH);
    int totalAvailNodes =
            (type == NodeType.OFF_SWITCH) ? scheduler.getNumClusterNodes() :
                    scheduler.getNumNodesInRack(node.getRackName());
    int numAllowedReservations =
            (int)Math.ceil(
                    totalAvailNodes * scheduler.getReservableNodesRatio());
    if (existingReservations >= numAllowedReservations) {
      DecimalFormat df = new DecimalFormat();
      df.setMaximumFractionDigits(2);
      if (LOG.isDebugEnabled()) {
        LOG.debug("Reservation Exceeds Allowed number of nodes:" +
                " app_id=" + getApplicationId() +
                " existingReservations=" + existingReservations +
                " totalAvailableNodes=" + totalAvailNodes +
                " reservableNodesRatio=" + df.format(
                                        scheduler.getReservableNodesRatio()) +
                " numAllowedReservations=" + numAllowedReservations);
      }
      return true;
    }
  }
  return false;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:29,代码来源:FSAppAttempt.java

示例14: 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

示例15: getAllowedLocalityLevelByTime

/**
 * Return the level at which we are allowed to schedule containers.
 * Given the thresholds indicating how much time passed before relaxing
 * scheduling constraints.
 */
public synchronized NodeType getAllowedLocalityLevelByTime(Priority priority,
        long nodeLocalityDelayMs, long rackLocalityDelayMs,
        long currentTimeMs) {

  // if not being used, can schedule anywhere
  if (nodeLocalityDelayMs < 0 || rackLocalityDelayMs < 0) {
    return NodeType.OFF_SWITCH;
  }

  // default level is NODE_LOCAL
  if (! allowedLocalityLevel.containsKey(priority)) {
    allowedLocalityLevel.put(priority, NodeType.NODE_LOCAL);
    return NodeType.NODE_LOCAL;
  }

  NodeType allowed = allowedLocalityLevel.get(priority);

  // if level is already most liberal, we're done
  if (allowed.equals(NodeType.OFF_SWITCH)) {
    return NodeType.OFF_SWITCH;
  }

  // check waiting time
  long waitTime = currentTimeMs;
  if (lastScheduledContainer.containsKey(priority)) {
    waitTime -= lastScheduledContainer.get(priority);
  } else {
    waitTime -= getStartTime();
  }

  long thresholdTime = allowed.equals(NodeType.NODE_LOCAL) ?
          nodeLocalityDelayMs : rackLocalityDelayMs;

  if (waitTime > thresholdTime) {
    if (allowed.equals(NodeType.NODE_LOCAL)) {
      allowedLocalityLevel.put(priority, NodeType.RACK_LOCAL);
      resetSchedulingOpportunities(priority, currentTimeMs);
    } else if (allowed.equals(NodeType.RACK_LOCAL)) {
      allowedLocalityLevel.put(priority, NodeType.OFF_SWITCH);
      resetSchedulingOpportunities(priority, currentTimeMs);
    }
  }
  return allowedLocalityLevel.get(priority);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:49,代码来源:FSAppAttempt.java


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