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


Java NodeAction.NORMAL属性代码示例

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


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

示例1: testRMVersionLessThanMinimum

@Test
public void testRMVersionLessThanMinimum() throws InterruptedException {
  final AtomicInteger numCleanups = new AtomicInteger(0);
  YarnConfiguration conf = createNMConfig();
  conf.set(YarnConfiguration.NM_RESOURCEMANAGER_MINIMUM_VERSION, "3.0.0");
  nm = new NodeManager() {
    @Override
    protected NodeStatusUpdater createNodeStatusUpdater(Context context,
                                                        Dispatcher dispatcher, NodeHealthCheckerService healthChecker) {
      MyNodeStatusUpdater myNodeStatusUpdater = new MyNodeStatusUpdater(
          context, dispatcher, healthChecker, metrics);
      MyResourceTracker2 myResourceTracker2 = new MyResourceTracker2();
      myResourceTracker2.heartBeatNodeAction = NodeAction.NORMAL;
      myResourceTracker2.rmVersion = "3.0.0";
      myNodeStatusUpdater.resourceTracker = myResourceTracker2;
      return myNodeStatusUpdater;
    }

    @Override
    protected ContainerManagerImpl createContainerManager(Context context,
        ContainerExecutor exec, DeletionService del,
        NodeStatusUpdater nodeStatusUpdater,
        ApplicationACLsManager aclsManager,
        LocalDirsHandlerService dirsHandler) {
      return new ContainerManagerImpl(context, exec, del, nodeStatusUpdater,
          metrics, aclsManager, dirsHandler) {

        @Override
        public void cleanUpApplicationsOnNMShutDown() {
          super.cleanUpApplicationsOnNMShutDown();
          numCleanups.incrementAndGet();
        }
      };
    }
  };

  nm.init(conf);
  nm.start();

  // NM takes a while to reach the STARTED state.
  int waitCount = 0;
  while (nm.getServiceState() != STATE.STARTED && waitCount++ != 20) {
    LOG.info("Waiting for NM to stop..");
    Thread.sleep(1000);
  }
  Assert.assertTrue(nm.getServiceState() == STATE.STARTED);
  nm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:48,代码来源:TestNodeStatusUpdater.java

示例2: testRMVersionLessThanMinimum

@Test
public void testRMVersionLessThanMinimum() throws InterruptedException,
    IOException {
  final AtomicInteger numCleanups = new AtomicInteger(0);
  YarnConfiguration conf = createNMConfig();
  conf.set(YarnConfiguration.NM_RESOURCEMANAGER_MINIMUM_VERSION, "3.0.0");
  nm = new NodeManager() {
    @Override
    protected NodeStatusUpdater createNodeStatusUpdater(Context context,
                                                        Dispatcher dispatcher, NodeHealthCheckerService healthChecker) {
      MyNodeStatusUpdater myNodeStatusUpdater = new MyNodeStatusUpdater(
          context, dispatcher, healthChecker, metrics);
      MyResourceTracker2 myResourceTracker2 = new MyResourceTracker2();
      myResourceTracker2.heartBeatNodeAction = NodeAction.NORMAL;
      myResourceTracker2.rmVersion = "3.0.0";
      myNodeStatusUpdater.resourceTracker = myResourceTracker2;
      return myNodeStatusUpdater;
    }

    @Override
    protected ContainerManagerImpl createContainerManager(Context context,
        ContainerExecutor exec, DeletionService del,
        NodeStatusUpdater nodeStatusUpdater,
        ApplicationACLsManager aclsManager,
        LocalDirsHandlerService dirsHandler) {
      return new ContainerManagerImpl(context, exec, del, nodeStatusUpdater,
          metrics, dirsHandler) {

        @Override
        public void cleanUpApplicationsOnNMShutDown() {
          super.cleanUpApplicationsOnNMShutDown();
          numCleanups.incrementAndGet();
        }
      };
    }
  };

  nm.init(conf);
  nm.start();

  // NM takes a while to reach the STARTED state.
  int waitCount = 0;
  while (nm.getServiceState() != STATE.STARTED && waitCount++ != 20) {
    LOG.info("Waiting for NM to stop..");
    Thread.sleep(1000);
  }
  Assert.assertTrue(nm.getServiceState() == STATE.STARTED);
  nm.stop();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:49,代码来源:TestNodeStatusUpdater.java


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