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


Java FiCaSchedulerApp.getNodeIdToUnreserve方法代码示例

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


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

示例1: findNodeToUnreserve

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp; //导入方法依赖的package包/类
@Private
protected boolean findNodeToUnreserve(Resource clusterResource,
    FiCaSchedulerNode node, FiCaSchedulerApp application, Priority priority,
    Resource minimumUnreservedResource) {
  // need to unreserve some other container first
  NodeId idToUnreserve =
      application.getNodeIdToUnreserve(priority, minimumUnreservedResource,
          resourceCalculator, clusterResource);
  if (idToUnreserve == null) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("checked to see if could unreserve for app but nothing "
          + "reserved that matches for this app");
    }
    return false;
  }
  FiCaSchedulerNode nodeToUnreserve = scheduler.getNode(idToUnreserve);
  if (nodeToUnreserve == null) {
    LOG.error("node to unreserve doesn't exist, nodeid: " + idToUnreserve);
    return false;
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("unreserving for app: " + application.getApplicationId()
      + " on nodeId: " + idToUnreserve
      + " in order to replace reserved application and place it on node: "
      + node.getNodeID() + " needing: " + minimumUnreservedResource);
  }

  // headroom
  Resources.addTo(application.getHeadroom(), nodeToUnreserve
      .getReservedContainer().getReservedResource());

  // Make sure to not have completedContainers sort the queues here since
  // we are already inside an iterator loop for the queues and this would
  // cause an concurrent modification exception.
  completedContainer(clusterResource, application, nodeToUnreserve,
      nodeToUnreserve.getReservedContainer(),
      SchedulerUtils.createAbnormalContainerStatus(nodeToUnreserve
          .getReservedContainer().getContainerId(),
          SchedulerUtils.UNRESERVED_CONTAINER),
      RMContainerEventType.RELEASED, null, false);
  return true;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:43,代码来源:LeafQueue.java

示例2: testGetAppToUnreserve

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp; //导入方法依赖的package包/类
@Test
public void testGetAppToUnreserve() throws Exception {

  CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration();
  setup(csConf);
  final String user_0 = "user_0";
  final ApplicationAttemptId appAttemptId_0 = TestUtils
      .getMockApplicationAttemptId(0, 0);
  LeafQueue a = stubLeafQueue((LeafQueue) queues.get(A));
  FiCaSchedulerApp app_0 = new FiCaSchedulerApp(appAttemptId_0, user_0, a,
      mock(ActiveUsersManager.class), spyRMContext);

  String host_0 = "host_0";
  FiCaSchedulerNode node_0 = TestUtils.getMockNode(host_0, DEFAULT_RACK, 0,
      8 * GB);
  String host_1 = "host_1";
  FiCaSchedulerNode node_1 = TestUtils.getMockNode(host_1, DEFAULT_RACK, 0,
      8 * GB);
  
  Resource clusterResource = Resources.createResource(2 * 8 * GB);

  // Setup resource-requests
  Priority priorityMap = TestUtils.createMockPriority(5);
  Resource capability = Resources.createResource(2*GB, 0);

  RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
  SystemMetricsPublisher publisher = mock(SystemMetricsPublisher.class);
  RMContext rmContext = mock(RMContext.class);
  ContainerAllocationExpirer expirer =
    mock(ContainerAllocationExpirer.class);
  DrainDispatcher drainDispatcher = new DrainDispatcher();
  when(rmContext.getContainerAllocationExpirer()).thenReturn(expirer);
  when(rmContext.getDispatcher()).thenReturn(drainDispatcher);
  when(rmContext.getRMApplicationHistoryWriter()).thenReturn(writer);
  when(rmContext.getSystemMetricsPublisher()).thenReturn(publisher);
  ApplicationAttemptId appAttemptId = BuilderUtils.newApplicationAttemptId(
      app_0.getApplicationId(), 1);
  ContainerId containerId = BuilderUtils.newContainerId(appAttemptId, 1);
  Container container = TestUtils.getMockContainer(containerId,
      node_1.getNodeID(), Resources.createResource(2*GB), priorityMap);
  RMContainer rmContainer = new RMContainerImpl(container, appAttemptId,
      node_1.getNodeID(), "user", rmContext);

  Container container_1 = TestUtils.getMockContainer(containerId,
      node_0.getNodeID(), Resources.createResource(1*GB), priorityMap);
  RMContainer rmContainer_1 = new RMContainerImpl(container_1, appAttemptId,
      node_0.getNodeID(), "user", rmContext);

  // no reserved containers
  NodeId unreserveId =
      app_0.getNodeIdToUnreserve(priorityMap, capability,
          cs.getResourceCalculator(), clusterResource);
  assertEquals(null, unreserveId);

  // no reserved containers - reserve then unreserve
  app_0.reserve(node_0, priorityMap, rmContainer_1, container_1);
  app_0.unreserve(node_0, priorityMap);
  unreserveId = app_0.getNodeIdToUnreserve(priorityMap, capability,
      cs.getResourceCalculator(), clusterResource);
  assertEquals(null, unreserveId);

  // no container large enough is reserved
  app_0.reserve(node_0, priorityMap, rmContainer_1, container_1);
  unreserveId = app_0.getNodeIdToUnreserve(priorityMap, capability,
      cs.getResourceCalculator(), clusterResource);
  assertEquals(null, unreserveId);

  // reserve one that is now large enough
  app_0.reserve(node_1, priorityMap, rmContainer, container);
  unreserveId = app_0.getNodeIdToUnreserve(priorityMap, capability,
      cs.getResourceCalculator(), clusterResource);
  assertEquals(node_1.getNodeID(), unreserveId);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:74,代码来源:TestReservations.java

示例3: testGetAppToUnreserve

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp; //导入方法依赖的package包/类
@Test
public void testGetAppToUnreserve() throws Exception {

  CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration();
  setup(csConf);
  final String user_0 = "user_0";
  final ApplicationAttemptId appAttemptId_0 = TestUtils
      .getMockApplicationAttemptId(0, 0);
  LeafQueue a = stubLeafQueue((LeafQueue) queues.get(A));
  FiCaSchedulerApp app_0 = new FiCaSchedulerApp(appAttemptId_0, user_0, a,
      mock(ActiveUsersManager.class), spyRMContext);

  String host_0 = "host_0";
  FiCaSchedulerNode node_0 = TestUtils.getMockNode(host_0, DEFAULT_RACK, 0,
      8 * GB);
  String host_1 = "host_1";
  FiCaSchedulerNode node_1 = TestUtils.getMockNode(host_1, DEFAULT_RACK, 0,
      8 * GB);
  
  Resource clusterResource = Resources.createResource(2 * 8 * GB);

  // Setup resource-requests
  Priority priorityMap = TestUtils.createMockPriority(5);
  Resource capability = Resources.createResource(2*GB, 0);

  RMApplicationHistoryWriter writer = mock(RMApplicationHistoryWriter.class);
  SystemMetricsPublisher publisher = mock(SystemMetricsPublisher.class);
  RMContext rmContext = mock(RMContext.class);
  ContainerAllocationExpirer expirer =
    mock(ContainerAllocationExpirer.class);
  DrainDispatcher drainDispatcher = new DrainDispatcher();
  when(rmContext.getContainerAllocationExpirer()).thenReturn(expirer);
  when(rmContext.getDispatcher()).thenReturn(drainDispatcher);
  when(rmContext.getRMApplicationHistoryWriter()).thenReturn(writer);
  when(rmContext.getSystemMetricsPublisher()).thenReturn(publisher);
  when(rmContext.getYarnConfiguration()).thenReturn(new YarnConfiguration());
  ApplicationAttemptId appAttemptId = BuilderUtils.newApplicationAttemptId(
      app_0.getApplicationId(), 1);
  ContainerId containerId = BuilderUtils.newContainerId(appAttemptId, 1);
  Container container = TestUtils.getMockContainer(containerId,
      node_1.getNodeID(), Resources.createResource(2*GB), priorityMap);
  RMContainer rmContainer = new RMContainerImpl(container, appAttemptId,
      node_1.getNodeID(), "user", rmContext);

  Container container_1 = TestUtils.getMockContainer(containerId,
      node_0.getNodeID(), Resources.createResource(1*GB), priorityMap);
  RMContainer rmContainer_1 = new RMContainerImpl(container_1, appAttemptId,
      node_0.getNodeID(), "user", rmContext);

  // no reserved containers
  NodeId unreserveId =
      app_0.getNodeIdToUnreserve(priorityMap, capability,
          cs.getResourceCalculator(), clusterResource);
  assertEquals(null, unreserveId);

  // no reserved containers - reserve then unreserve
  app_0.reserve(node_0, priorityMap, rmContainer_1, container_1);
  app_0.unreserve(priorityMap, node_0, rmContainer_1);
  unreserveId = app_0.getNodeIdToUnreserve(priorityMap, capability,
      cs.getResourceCalculator(), clusterResource);
  assertEquals(null, unreserveId);

  // no container large enough is reserved
  app_0.reserve(node_0, priorityMap, rmContainer_1, container_1);
  unreserveId = app_0.getNodeIdToUnreserve(priorityMap, capability,
      cs.getResourceCalculator(), clusterResource);
  assertEquals(null, unreserveId);

  // reserve one that is now large enough
  app_0.reserve(node_1, priorityMap, rmContainer, container);
  unreserveId = app_0.getNodeIdToUnreserve(priorityMap, capability,
      cs.getResourceCalculator(), clusterResource);
  assertEquals(node_1.getNodeID(), unreserveId);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:75,代码来源:TestReservations.java

示例4: findNodeToUnreserve

import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp; //导入方法依赖的package包/类
@Private
protected boolean findNodeToUnreserve(Resource clusterResource,
    FiCaSchedulerNode node, FiCaSchedulerApp application, Priority priority,
    Resource minimumUnreservedResource) {
  // need to unreserve some other container first
  NodeId idToUnreserve =
      application.getNodeIdToUnreserve(priority, minimumUnreservedResource,
          resourceCalculator, clusterResource);
  
  
  if (idToUnreserve == null) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("checked to see if could unreserve for app but nothing "
          + "reserved that matches for this app");
    }
    return false;
  }
  FiCaSchedulerNode nodeToUnreserve = scheduler.getNode(idToUnreserve);
  if (nodeToUnreserve == null) {
    LOG.error("node to unreserve doesn't exist, nodeid: " + idToUnreserve);
    return false;
  }
  
 {
    LOG.info("unreserving for app: " + application.getApplicationId()
      + " on nodeId: " + idToUnreserve
      + " in order to replace reserved application and place it on node: "
      + node.getNodeID() + " needing: " + minimumUnreservedResource);
  }

  // headroom
  Resources.addTo(application.getHeadroom(), nodeToUnreserve
      .getReservedContainer().getReservedResource());

  // Make sure to not have completedContainers sort the queues here since
  // we are already inside an iterator loop for the queues and this would
  // cause an concurrent modification exception.
  completedContainer(clusterResource, application, nodeToUnreserve,
      nodeToUnreserve.getReservedContainer(),
      SchedulerUtils.createAbnormalContainerStatus(nodeToUnreserve
          .getReservedContainer().getContainerId(),
          SchedulerUtils.UNRESERVED_CONTAINER),
      RMContainerEventType.RELEASED, null, false);
  return true;
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:46,代码来源:LeafQueue.java


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