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


Java ServiceOperations类代码示例

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


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

示例1: testQueueParsingWithLabels

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@Test
public void testQueueParsingWithLabels() throws IOException {
  nodeLabelManager.addToCluserNodeLabels(ImmutableSet.of("red", "blue"));
  
  YarnConfiguration conf = new YarnConfiguration();
  CapacitySchedulerConfiguration csConf =
      new CapacitySchedulerConfiguration(conf);
  setupQueueConfigurationWithLabels(csConf);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  RMContextImpl rmContext =
      new RMContextImpl(null, null, null, null, null, null,
          new RMContainerTokenSecretManager(csConf),
          new NMTokenSecretManagerInRM(csConf),
          new ClientToAMTokenSecretManagerInRM(), null);
  rmContext.setNodeLabelManager(nodeLabelManager);
  capacityScheduler.setConf(csConf);
  capacityScheduler.setRMContext(rmContext);
  capacityScheduler.init(csConf);
  capacityScheduler.start();
  checkQueueLabels(capacityScheduler);
  ServiceOperations.stopQuietly(capacityScheduler);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestQueueParsing.java

示例2: testQueueParsingWithLabelsInherit

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@Test
public void testQueueParsingWithLabelsInherit() throws IOException {
  nodeLabelManager.addToCluserNodeLabels(ImmutableSet.of("red", "blue"));

  YarnConfiguration conf = new YarnConfiguration();
  CapacitySchedulerConfiguration csConf =
      new CapacitySchedulerConfiguration(conf);
  setupQueueConfigurationWithLabelsInherit(csConf);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  RMContextImpl rmContext =
      new RMContextImpl(null, null, null, null, null, null,
          new RMContainerTokenSecretManager(csConf),
          new NMTokenSecretManagerInRM(csConf),
          new ClientToAMTokenSecretManagerInRM(), null);
  rmContext.setNodeLabelManager(nodeLabelManager);
  capacityScheduler.setConf(csConf);
  capacityScheduler.setRMContext(rmContext);
  capacityScheduler.init(csConf);
  capacityScheduler.start();
  checkQueueLabelsInheritConfig(capacityScheduler);
  ServiceOperations.stopQuietly(capacityScheduler);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestQueueParsing.java

示例3: testQueueParsingWhenLabelsNotExist

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@Test
public void testQueueParsingWhenLabelsNotExist() throws IOException {
  YarnConfiguration conf = new YarnConfiguration();
  CapacitySchedulerConfiguration csConf =
      new CapacitySchedulerConfiguration(conf);
  setupQueueConfigurationWithLabels(csConf);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  RMContextImpl rmContext =
      new RMContextImpl(null, null, null, null, null, null,
          new RMContainerTokenSecretManager(csConf),
          new NMTokenSecretManagerInRM(csConf),
          new ClientToAMTokenSecretManagerInRM(), null);
  
  RMNodeLabelsManager nodeLabelsManager = new NullRMNodeLabelsManager();
  nodeLabelsManager.init(conf);
  nodeLabelsManager.start();
  
  rmContext.setNodeLabelManager(nodeLabelsManager);
  capacityScheduler.setConf(csConf);
  capacityScheduler.setRMContext(rmContext);
  capacityScheduler.init(csConf);
  capacityScheduler.start();
  ServiceOperations.stopQuietly(capacityScheduler);
  ServiceOperations.stopQuietly(nodeLabelsManager);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestQueueParsing.java

示例4: testQueueParsingFailWhenSumOfChildrenNonLabeledCapacityNot100Percent

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
/**
 * Test init a queue configuration, children's capacity for a given label
 * doesn't equals to 100%. This expect IllegalArgumentException thrown.
 */
@Test(expected = IllegalArgumentException.class)
public void testQueueParsingFailWhenSumOfChildrenNonLabeledCapacityNot100Percent()
    throws IOException {
  nodeLabelManager.addToCluserNodeLabels(ImmutableSet
      .of("red", "blue"));
  
  YarnConfiguration conf = new YarnConfiguration();
  CapacitySchedulerConfiguration csConf =
      new CapacitySchedulerConfiguration(conf);
  setupQueueConfiguration(csConf);
  csConf.setCapacity(CapacitySchedulerConfiguration.ROOT + ".c.c2", 5);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  RMContextImpl rmContext =
      new RMContextImpl(null, null, null, null, null, null,
          new RMContainerTokenSecretManager(csConf),
          new NMTokenSecretManagerInRM(csConf),
          new ClientToAMTokenSecretManagerInRM(), null);
  rmContext.setNodeLabelManager(nodeLabelManager);
  capacityScheduler.setConf(csConf);
  capacityScheduler.setRMContext(rmContext);
  capacityScheduler.init(csConf);
  capacityScheduler.start();
  ServiceOperations.stopQuietly(capacityScheduler);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:TestQueueParsing.java

示例5: userZookeeperToCreateRoot

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
/**
 * have the ZK user create the root dir.
 * This logs out the ZK user after and stops its curator instance,
 * to avoid contamination
 * @throws Throwable
 */
public void userZookeeperToCreateRoot() throws Throwable {

  System.setProperty("curator-log-events", "true");
  CuratorService curator = null;
  LoginContext login = login(ZOOKEEPER_LOCALHOST,
      ZOOKEEPER_CLIENT_CONTEXT,
      keytab_zk);
  try {
    logLoginDetails(ZOOKEEPER, login);
    RegistrySecurity.setZKSaslClientProperties(ZOOKEEPER,
        ZOOKEEPER_CLIENT_CONTEXT);
    curator = startCuratorServiceInstance("ZK", true);
    LOG.info(curator.toString());

    addToTeardown(curator);
    curator.zkMkPath("/", CreateMode.PERSISTENT, false,
        RegistrySecurity.WorldReadWriteACL);
    ZKPathDumper pathDumper = curator.dumpPath(true);
    LOG.info(pathDumper.toString());
  } finally {
    logout(login);
    ServiceOperations.stop(curator);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestSecureRegistry.java

示例6: testQueueParsingReinitializeWithLabels

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@Test
public void testQueueParsingReinitializeWithLabels() throws IOException {
  nodeLabelManager.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("red", "blue"));
  CapacitySchedulerConfiguration csConf =
      new CapacitySchedulerConfiguration();
  setupQueueConfigurationWithoutLabels(csConf);
  YarnConfiguration conf = new YarnConfiguration(csConf);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  RMContextImpl rmContext =
      new RMContextImpl(null, null, null, null, null, null,
          new RMContainerTokenSecretManager(conf),
          new NMTokenSecretManagerInRM(conf),
          new ClientToAMTokenSecretManagerInRM(), null);
  rmContext.setNodeLabelManager(nodeLabelManager);
  capacityScheduler.setConf(conf);
  capacityScheduler.setRMContext(rmContext);
  capacityScheduler.init(conf);
  capacityScheduler.start();
  csConf = new CapacitySchedulerConfiguration();
  setupQueueConfigurationWithLabels(csConf);
  conf = new YarnConfiguration(csConf);
  capacityScheduler.reinitialize(conf, rmContext);
  checkQueueLabels(capacityScheduler);
  ServiceOperations.stopQuietly(capacityScheduler);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:27,代码来源:TestQueueParsing.java

示例7: testQueueParsingWithLabels

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@Test
public void testQueueParsingWithLabels() throws IOException {
  nodeLabelManager.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("red", "blue"));
  
  YarnConfiguration conf = new YarnConfiguration();
  CapacitySchedulerConfiguration csConf =
      new CapacitySchedulerConfiguration(conf);
  setupQueueConfigurationWithLabels(csConf);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  RMContextImpl rmContext =
      new RMContextImpl(null, null, null, null, null, null,
          new RMContainerTokenSecretManager(csConf),
          new NMTokenSecretManagerInRM(csConf),
          new ClientToAMTokenSecretManagerInRM(), null);
  rmContext.setNodeLabelManager(nodeLabelManager);
  capacityScheduler.setConf(csConf);
  capacityScheduler.setRMContext(rmContext);
  capacityScheduler.init(csConf);
  capacityScheduler.start();
  checkQueueLabels(capacityScheduler);
  ServiceOperations.stopQuietly(capacityScheduler);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:TestQueueParsing.java

示例8: testQueueParsingWithLabelsInherit

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@Test
public void testQueueParsingWithLabelsInherit() throws IOException {
  nodeLabelManager.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet.of("red", "blue"));

  YarnConfiguration conf = new YarnConfiguration();
  CapacitySchedulerConfiguration csConf =
      new CapacitySchedulerConfiguration(conf);
  setupQueueConfigurationWithLabelsInherit(csConf);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  RMContextImpl rmContext =
      new RMContextImpl(null, null, null, null, null, null,
          new RMContainerTokenSecretManager(csConf),
          new NMTokenSecretManagerInRM(csConf),
          new ClientToAMTokenSecretManagerInRM(), null);
  rmContext.setNodeLabelManager(nodeLabelManager);
  capacityScheduler.setConf(csConf);
  capacityScheduler.setRMContext(rmContext);
  capacityScheduler.init(csConf);
  capacityScheduler.start();
  checkQueueLabelsInheritConfig(capacityScheduler);
  ServiceOperations.stopQuietly(capacityScheduler);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:TestQueueParsing.java

示例9: testQueueParsingFailWhenSumOfChildrenNonLabeledCapacityNot100Percent

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
/**
 * Test init a queue configuration, children's capacity for a given label
 * doesn't equals to 100%. This expect IllegalArgumentException thrown.
 */
@Test(expected = IllegalArgumentException.class)
public void testQueueParsingFailWhenSumOfChildrenNonLabeledCapacityNot100Percent()
    throws IOException {
  nodeLabelManager.addToCluserNodeLabelsWithDefaultExclusivity(ImmutableSet
      .of("red", "blue"));
  
  YarnConfiguration conf = new YarnConfiguration();
  CapacitySchedulerConfiguration csConf =
      new CapacitySchedulerConfiguration(conf);
  setupQueueConfiguration(csConf);
  csConf.setCapacity(CapacitySchedulerConfiguration.ROOT + ".c.c2", 5);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  RMContextImpl rmContext =
      new RMContextImpl(null, null, null, null, null, null,
          new RMContainerTokenSecretManager(csConf),
          new NMTokenSecretManagerInRM(csConf),
          new ClientToAMTokenSecretManagerInRM(), null);
  rmContext.setNodeLabelManager(nodeLabelManager);
  capacityScheduler.setConf(csConf);
  capacityScheduler.setRMContext(rmContext);
  capacityScheduler.init(csConf);
  capacityScheduler.start();
  ServiceOperations.stopQuietly(capacityScheduler);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:30,代码来源:TestQueueParsing.java

示例10: testQueueParsingReinitializeWithLabels

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@Test
public void testQueueParsingReinitializeWithLabels() throws IOException {
  nodeLabelManager.addToCluserNodeLabels(ImmutableSet.of("red", "blue"));
  CapacitySchedulerConfiguration csConf =
      new CapacitySchedulerConfiguration();
  setupQueueConfigurationWithoutLabels(csConf);
  YarnConfiguration conf = new YarnConfiguration(csConf);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  RMContextImpl rmContext =
      new RMContextImpl(null, null, null, null, null, null,
          new RMContainerTokenSecretManager(conf),
          new NMTokenSecretManagerInRM(conf),
          new ClientToAMTokenSecretManagerInRM(), null);
  rmContext.setNodeLabelManager(nodeLabelManager);
  capacityScheduler.setConf(conf);
  capacityScheduler.setRMContext(rmContext);
  capacityScheduler.init(conf);
  capacityScheduler.start();
  csConf = new CapacitySchedulerConfiguration();
  setupQueueConfigurationWithLabels(csConf);
  conf = new YarnConfiguration(csConf);
  capacityScheduler.reinitialize(conf, rmContext);
  checkQueueLabels(capacityScheduler);
  ServiceOperations.stopQuietly(capacityScheduler);
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:27,代码来源:TestQueueParsing.java

示例11: testQueueParsingWhenLabelsNotExist

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@Test(expected = Exception.class)
public void testQueueParsingWhenLabelsNotExist() throws IOException {
  YarnConfiguration conf = new YarnConfiguration();
  CapacitySchedulerConfiguration csConf =
      new CapacitySchedulerConfiguration(conf);
  setupQueueConfigurationWithLabels(csConf);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  RMContextImpl rmContext =
      new RMContextImpl(null, null, null, null, null, null,
          new RMContainerTokenSecretManager(csConf),
          new NMTokenSecretManagerInRM(csConf),
          new ClientToAMTokenSecretManagerInRM(), null);
  
  RMNodeLabelsManager nodeLabelsManager = new MemoryRMNodeLabelsManager();
  nodeLabelsManager.init(conf);
  nodeLabelsManager.start();
  
  rmContext.setNodeLabelManager(nodeLabelsManager);
  capacityScheduler.setConf(csConf);
  capacityScheduler.setRMContext(rmContext);
  capacityScheduler.init(csConf);
  capacityScheduler.start();
  ServiceOperations.stopQuietly(capacityScheduler);
  ServiceOperations.stopQuietly(nodeLabelsManager);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:27,代码来源:TestQueueParsing.java

示例12: serviceStop

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@Override
protected void serviceStop() throws Exception {
  LOG.info("Stopping {}", getName());
  stopExecutors.set(true);
  if (executor != null) {
    executor.shutdown();
    if (executor.isTerminating()) {
      LOG.info("Waiting for executor to terminate");
      boolean terminated = executor.awaitTermination(10, TimeUnit.SECONDS);
      if (terminated) {
        LOG.info("Executor terminated");
      } else {
        LOG.warn("Executor did not terminate");
        executor.shutdownNow();
      }
    }
  }
  synchronized (cachedLogs) {
    for (EntityCacheItem cacheItem : cachedLogs.values()) {
      ServiceOperations.stopQuietly(cacheItem.getStore());
    }
  }
  CallerContext.setCurrent(null);
  super.serviceStop();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:26,代码来源:EntityGroupFSTimelineStore.java

示例13: tearDown

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@After
public void tearDown() {
  this.registeredNodes.clear();
  heartBeatID = 0;
  ServiceOperations.stop(nm);
  assertionFailedInThread.set(false);
  DefaultMetricsSystem.shutdown();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:TestNodeStatusUpdater.java

示例14: testQueueParsing

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@Test
public void testQueueParsing() throws Exception {
  CapacitySchedulerConfiguration csConf = 
    new CapacitySchedulerConfiguration();
  setupQueueConfiguration(csConf);
  YarnConfiguration conf = new YarnConfiguration(csConf);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  capacityScheduler.setConf(conf);
  capacityScheduler.setRMContext(TestUtils.getMockRMContext());
  capacityScheduler.init(conf);
  capacityScheduler.start();
  capacityScheduler.reinitialize(conf, TestUtils.getMockRMContext());
  
  CSQueue a = capacityScheduler.getQueue("a");
  Assert.assertEquals(0.10, a.getAbsoluteCapacity(), DELTA);
  Assert.assertEquals(0.15, a.getAbsoluteMaximumCapacity(), DELTA);
  
  CSQueue b1 = capacityScheduler.getQueue("b1");
  Assert.assertEquals(0.2 * 0.5, b1.getAbsoluteCapacity(), DELTA);
  Assert.assertEquals("Parent B has no MAX_CAP", 
      0.85, b1.getAbsoluteMaximumCapacity(), DELTA);
  
  CSQueue c12 = capacityScheduler.getQueue("c12");
  Assert.assertEquals(0.7 * 0.5 * 0.45, c12.getAbsoluteCapacity(), DELTA);
  Assert.assertEquals(0.7 * 0.55 * 0.7, 
      c12.getAbsoluteMaximumCapacity(), DELTA);
  ServiceOperations.stopQuietly(capacityScheduler);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:TestQueueParsing.java

示例15: testRootQueueParsing

import org.apache.hadoop.service.ServiceOperations; //导入依赖的package包/类
@Test (expected=java.lang.IllegalArgumentException.class)
public void testRootQueueParsing() throws Exception {
  CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();

  // non-100 percent value will throw IllegalArgumentException
  conf.setCapacity(CapacitySchedulerConfiguration.ROOT, 90);

  CapacityScheduler capacityScheduler = new CapacityScheduler();
  capacityScheduler.setConf(new YarnConfiguration());
  capacityScheduler.init(conf);
  capacityScheduler.start();
  capacityScheduler.reinitialize(conf, null);
  ServiceOperations.stopQuietly(capacityScheduler);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:TestQueueParsing.java


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