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


Java NodeType类代码示例

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


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

示例1: assignNodeLocalContainers

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
private int assignNodeLocalContainers(FiCaSchedulerNode node, 
    FiCaSchedulerApp application, Priority priority) {
  int assignedContainers = 0;
  ResourceRequest request = 
    application.getResourceRequest(priority, node.getNodeName());
  if (request != null) {
    // Don't allocate on this node if we don't need containers on this rack
    ResourceRequest rackRequest =
        application.getResourceRequest(priority, 
            node.getRMNode().getRackName());
    if (rackRequest == null || rackRequest.getNumContainers() <= 0) {
      return 0;
    }
    
    int assignableContainers = 
      Math.min(
          getMaxAllocatableContainers(application, priority, node, 
              NodeType.NODE_LOCAL), 
              request.getNumContainers());
    assignedContainers = 
      assignContainer(node, application, priority, 
          assignableContainers, request, NodeType.NODE_LOCAL);
  }
  return assignedContainers;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:FifoScheduler.java

示例2: assignRackLocalContainers

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
private int assignRackLocalContainers(FiCaSchedulerNode node, 
    FiCaSchedulerApp application, Priority priority) {
  int assignedContainers = 0;
  ResourceRequest request = 
    application.getResourceRequest(priority, node.getRMNode().getRackName());
  if (request != null) {
    // Don't allocate on this rack if the application doens't need containers
    ResourceRequest offSwitchRequest =
        application.getResourceRequest(priority, ResourceRequest.ANY);
    if (offSwitchRequest.getNumContainers() <= 0) {
      return 0;
    }
    
    int assignableContainers = 
      Math.min(
          getMaxAllocatableContainers(application, priority, node, 
              NodeType.RACK_LOCAL), 
              request.getNumContainers());
    assignedContainers = 
      assignContainer(node, application, priority, 
          assignableContainers, request, NodeType.RACK_LOCAL);
  }
  return assignedContainers;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:FifoScheduler.java

示例3: assignReservedContainer

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
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,代码行数:19,代码来源:LeafQueue.java

示例4: assign

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
public synchronized void assign(List<Container> containers) 
throws IOException, YarnException {
  
  int numContainers = containers.size();
  // Schedule in priority order
  for (Priority priority : requests.keySet()) {
    assign(priority, NodeType.NODE_LOCAL, containers);
    assign(priority, NodeType.RACK_LOCAL, containers);
    assign(priority, NodeType.OFF_SWITCH, containers);

    if (containers.isEmpty()) { 
      break;
    }
  }
  
  int assignedContainers = numContainers - containers.size();
  LOG.info("Application " + applicationId + " assigned " + 
      assignedContainers + "/" + numContainers);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:Application.java

示例5: testLocalityLevelWithoutDelays

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
@Test
/**
 * Ensure that when negative paramaters are given (signaling delay scheduling
 * no tin use), the least restrictive locality level is returned.
 */
public void testLocalityLevelWithoutDelays() {
  FSLeafQueue queue = Mockito.mock(FSLeafQueue.class);
  Priority prio = Mockito.mock(Priority.class);
  Mockito.when(prio.getPriority()).thenReturn(1);

  RMContext rmContext = resourceManager.getRMContext();
  ApplicationAttemptId applicationAttemptId = createAppAttemptId(1, 1);
  FSAppAttempt schedulerApp =
      new FSAppAttempt(scheduler, applicationAttemptId, "user1", queue ,
          null, rmContext);
  assertEquals(NodeType.OFF_SWITCH, schedulerApp.getAllowedLocalityLevel(
      prio, 10, -1.0, -1.0));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestFSAppAttempt.java

示例6: createReservedIncreasedCSAssignment

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
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,代码行数:17,代码来源:IncreaseContainerAllocator.java

示例7: createSuccessfullyIncreasedCSAssignment

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
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,代码行数:25,代码来源:IncreaseContainerAllocator.java

示例8: assignReservedContainer

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
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,代码行数:20,代码来源:LeafQueue.java

示例9: assignReservedContainer

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
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,代码行数:19,代码来源:LeafQueue.java

示例10: assignNodeLocalContainers

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
private int assignNodeLocalContainers(FiCaSchedulerNode node, 
    FiCaSchedulerApp application, Priority priority) {
  int assignedContainers = 0;
  ResourceRequest request = 
    application.getResourceRequest(priority, node.getHostName());
  if (request != null) {
    // Don't allocate on this node if we don't need containers on this rack
    ResourceRequest rackRequest =
        application.getResourceRequest(priority, 
            node.getRMNode().getRackName());
    if (rackRequest == null || rackRequest.getNumContainers() <= 0) {
      return 0;
    }
    
    int assignableContainers = 
      Math.min(
          getMaxAllocatableContainers(application, priority, node, 
              NodeType.NODE_LOCAL), 
              request.getNumContainers());
    assignedContainers = 
      assignContainer(node, application, priority, 
          assignableContainers, request, NodeType.NODE_LOCAL);
  }
  return assignedContainers;
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:FifoScheduler.java

示例11: assignReservedContainer

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
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);
  
  // 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:ict-carch,项目名称:hadoop-plus,代码行数:19,代码来源:LeafQueue.java

示例12: testLocalityLevelWithoutDelays

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
@Test
/**
 * Ensure that when negative paramaters are given (signaling delay scheduling
 * no tin use), the least restrictive locality level is returned.
 */
public void testLocalityLevelWithoutDelays() {
  Queue queue = Mockito.mock(Queue.class);
  Priority prio = Mockito.mock(Priority.class);
  Mockito.when(prio.getPriority()).thenReturn(1);

  ApplicationAttemptId applicationAttemptId = createAppAttemptId(1, 1);
  FSSchedulerApp schedulerApp =
      new FSSchedulerApp(applicationAttemptId, "user1", queue , null, null);
  assertEquals(NodeType.OFF_SWITCH, schedulerApp.getAllowedLocalityLevel(
      prio, 10, -1.0, -1.0));
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:17,代码来源:TestFSSchedulerApp.java

示例13: createReservedIncreasedCSAssignment

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
private CSAssignment createReservedIncreasedCSAssignment(
    SchedContainerChangeRequest request) {
  CSAssignment assignment =
      new CSAssignment(request.getDeltaCapacity(), NodeType.NODE_LOCAL, null,
          application, CSAssignment.SkippedType.NONE, 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:hopshadoop,项目名称:hops,代码行数:17,代码来源:IncreaseContainerAllocator.java

示例14: createSuccessfullyIncreasedCSAssignment

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
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,代码行数:25,代码来源:IncreaseContainerAllocator.java

示例15: getMaxAllocatableContainers

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; //导入依赖的package包/类
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,代码行数:35,代码来源:FifoScheduler.java


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