• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LinuxContainerExecutor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: init

import org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor; //导入依赖的package包/类
@VisibleForTesting
void init(LinuxContainerExecutor lce, ResourceCalculatorPlugin plugin)
    throws IOException {
  initConfig();

  // mount cgroups if requested
  if (cgroupMount && cgroupMountPath != null) {
    ArrayList<String> cgroupKVs = new ArrayList<String>();
    cgroupKVs.add(CONTROLLER_CPU + "=" + cgroupMountPath + "/" +
                  CONTROLLER_CPU);
    lce.mountCgroups(cgroupKVs, cgroupPrefix);
  }

  initializeControllerPaths();

  // cap overall usage to the number of cores allocated to YARN
  yarnProcessors = NodeManagerHardwareUtils.getContainersCores(plugin, conf);
  int systemProcessors = plugin.getNumProcessors();
  if (systemProcessors != (int) yarnProcessors) {
    LOG.info("YARN containers restricted to " + yarnProcessors + " cores");
    int[] limits = getOverallLimits(yarnProcessors);
    updateCgroup(CONTROLLER_CPU, "", CPU_PERIOD_US, String.valueOf(limits[0]));
    updateCgroup(CONTROLLER_CPU, "", CPU_QUOTA_US, String.valueOf(limits[1]));
  } else if (cpuLimitsExist()) {
    LOG.info("Removing CPU constraints for YARN containers.");
    updateCgroup(CONTROLLER_CPU, "", CPU_QUOTA_US, String.valueOf(-1));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:CgroupsLCEResourcesHandler.java


示例2: init

import org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor; //导入依赖的package包/类
@VisibleForTesting
void init(LinuxContainerExecutor lce, ResourceCalculatorPlugin plugin)
    throws IOException {
  initConfig();

  // mount cgroups if requested
  if (cgroupMount && cgroupMountPath != null) {
    ArrayList<String> cgroupKVs = new ArrayList<String>();
    cgroupKVs.add(CONTROLLER_CPU + "=" + cgroupMountPath + "/" +
                  CONTROLLER_CPU);
    lce.mountCgroups(cgroupKVs, cgroupPrefix);
  }

  initializeControllerPaths();

  nodeVCores = NodeManagerHardwareUtils.getVCores(plugin, conf);

  // cap overall usage to the number of cores allocated to YARN
  yarnProcessors = NodeManagerHardwareUtils.getContainersCPUs(plugin, conf);
  int systemProcessors = NodeManagerHardwareUtils.getNodeCPUs(plugin, conf);
  if (systemProcessors != (int) yarnProcessors) {
    LOG.info("YARN containers restricted to " + yarnProcessors + " cores");
    int[] limits = getOverallLimits(yarnProcessors);
    updateCgroup(CONTROLLER_CPU, "", CPU_PERIOD_US, String.valueOf(limits[0]));
    updateCgroup(CONTROLLER_CPU, "", CPU_QUOTA_US, String.valueOf(limits[1]));
  } else if (cpuLimitsExist()) {
    LOG.info("Removing CPU constraints for YARN containers.");
    updateCgroup(CONTROLLER_CPU, "", CPU_QUOTA_US, String.valueOf(-1));
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:31,代码来源:CgroupsLCEResourcesHandler.java


示例3: init

import org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor; //导入依赖的package包/类
public synchronized void init(LinuxContainerExecutor lce) throws IOException {

    this.cgroupPrefix = conf.get(YarnConfiguration.
            NM_LINUX_CONTAINER_CGROUPS_HIERARCHY, "/hadoop-yarn");
    this.cgroupMount = conf.getBoolean(YarnConfiguration.
            NM_LINUX_CONTAINER_CGROUPS_MOUNT, false);
    this.cgroupMountPath = conf.get(YarnConfiguration.
            NM_LINUX_CONTAINER_CGROUPS_MOUNT_PATH, null);

    // remove extra /'s at end or start of cgroupPrefix
    if (cgroupPrefix.charAt(0) == '/') {
      cgroupPrefix = cgroupPrefix.substring(1);
    }

    int len = cgroupPrefix.length();
    if (cgroupPrefix.charAt(len - 1) == '/') {
      cgroupPrefix = cgroupPrefix.substring(0, len - 1);
    }
  
    // mount cgroups if requested
    if (cgroupMount && cgroupMountPath != null) {
      ArrayList<String> cgroupKVs = new ArrayList<String>();
      cgroupKVs.add(CONTROLLER_CPU + "=" + cgroupMountPath + "/" +
                    CONTROLLER_CPU);
      lce.mountCgroups(cgroupKVs, cgroupPrefix);
    }

    initializeControllerPaths();
  }
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:30,代码来源:CgroupsLCEResourcesHandler.java


示例4: init

import org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor; //导入依赖的package包/类
public void init(LinuxContainerExecutor lce) throws IOException {
  initConfig();
  
  // mount cgroups if requested
  if (cgroupMount && cgroupMountPath != null) {
    ArrayList<String> cgroupKVs = new ArrayList<String>();
    cgroupKVs.add(CONTROLLER_CPU + "=" + cgroupMountPath + "/" +
                  CONTROLLER_CPU);
    lce.mountCgroups(cgroupKVs, cgroupPrefix);
  }

  initializeControllerPaths();
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:14,代码来源:CgroupsLCEResourcesHandler.java


示例5: init

import org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor; //导入依赖的package包/类
public void init(LinuxContainerExecutor lce) {
}
 
开发者ID:naver,项目名称:hadoop,代码行数:3,代码来源:DefaultLCEResourcesHandler.java


示例6: testInit

import org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor; //导入依赖的package包/类
@Test
public void testInit() throws IOException {
  LinuxContainerExecutor mockLCE = new MockLinuxContainerExecutor();
  CustomCgroupsLCEResourceHandler handler =
      new CustomCgroupsLCEResourceHandler();
  YarnConfiguration conf = new YarnConfiguration();
  final int numProcessors = 4;
  ResourceCalculatorPlugin plugin =
      Mockito.mock(ResourceCalculatorPlugin.class);
  Mockito.doReturn(numProcessors).when(plugin).getNumProcessors();
  handler.setConf(conf);
  handler.initConfig();

  // create mock cgroup
  File cgroupMountDir = createMockCgroupMount(cgroupDir);

  // create mock mtab
  File mockMtab = createMockMTab(cgroupDir);

  // setup our handler and call init()
  handler.setMtabFile(mockMtab.getAbsolutePath());

  // check values
  // in this case, we're using all cpu so the files
  // shouldn't exist(because init won't create them
  handler.init(mockLCE, plugin);
  File periodFile = new File(cgroupMountDir, "cpu.cfs_period_us");
  File quotaFile = new File(cgroupMountDir, "cpu.cfs_quota_us");
  Assert.assertFalse(periodFile.exists());
  Assert.assertFalse(quotaFile.exists());

  // subset of cpu being used, files should be created
  conf
    .setInt(YarnConfiguration.NM_RESOURCE_PERCENTAGE_PHYSICAL_CPU_LIMIT, 75);
  handler.limits[0] = 100 * 1000;
  handler.limits[1] = 1000 * 1000;
  handler.init(mockLCE, plugin);
  int period = readIntFromFile(periodFile);
  int quota = readIntFromFile(quotaFile);
  Assert.assertEquals(100 * 1000, period);
  Assert.assertEquals(1000 * 1000, quota);

  // set cpu back to 100, quota should be -1
  conf.setInt(YarnConfiguration.NM_RESOURCE_PERCENTAGE_PHYSICAL_CPU_LIMIT,
    100);
  handler.limits[0] = 100 * 1000;
  handler.limits[1] = 1000 * 1000;
  handler.init(mockLCE, plugin);
  quota = readIntFromFile(quotaFile);
  Assert.assertEquals(-1, quota);

  FileUtils.deleteQuietly(cgroupDir);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:54,代码来源:TestCgroupsLCEResourcesHandler.java


示例7: testInit

import org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor; //导入依赖的package包/类
@Test
public void testInit() throws IOException {
  LinuxContainerExecutor mockLCE = new MockLinuxContainerExecutor();
  CustomCgroupsLCEResourceHandler handler =
      new CustomCgroupsLCEResourceHandler();
  YarnConfiguration conf = new YarnConfiguration();
  final int numProcessors = 4;
  ResourceCalculatorPlugin plugin =
      Mockito.mock(ResourceCalculatorPlugin.class);
  Mockito.doReturn(numProcessors).when(plugin).getNumProcessors();
  Mockito.doReturn(numProcessors).when(plugin).getNumCores();
  handler.setConf(conf);
  handler.initConfig();

  // create mock cgroup
  File cpuCgroupMountDir = TestCGroupsHandlerImpl.createMockCgroupMount(
      cgroupDir, "cpu");

  // create mock mtab
  File mockMtab = TestCGroupsHandlerImpl.createMockMTab(cgroupDir);

  // setup our handler and call init()
  handler.setMtabFile(mockMtab.getAbsolutePath());

  // check values
  // in this case, we're using all cpu so the files
  // shouldn't exist(because init won't create them
  handler.init(mockLCE, plugin);
  File periodFile = new File(cpuCgroupMountDir, "cpu.cfs_period_us");
  File quotaFile = new File(cpuCgroupMountDir, "cpu.cfs_quota_us");
  Assert.assertFalse(periodFile.exists());
  Assert.assertFalse(quotaFile.exists());

  // subset of cpu being used, files should be created
  conf
    .setInt(YarnConfiguration.NM_RESOURCE_PERCENTAGE_PHYSICAL_CPU_LIMIT, 75);
  handler.limits[0] = 100 * 1000;
  handler.limits[1] = 1000 * 1000;
  handler.init(mockLCE, plugin);
  int period = readIntFromFile(periodFile);
  int quota = readIntFromFile(quotaFile);
  Assert.assertEquals(100 * 1000, period);
  Assert.assertEquals(1000 * 1000, quota);

  // set cpu back to 100, quota should be -1
  conf.setInt(YarnConfiguration.NM_RESOURCE_PERCENTAGE_PHYSICAL_CPU_LIMIT,
      100);
  handler.limits[0] = 100 * 1000;
  handler.limits[1] = 1000 * 1000;
  handler.init(mockLCE, plugin);
  quota = readIntFromFile(quotaFile);
  Assert.assertEquals(-1, quota);

  FileUtils.deleteQuietly(cgroupDir);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:56,代码来源:TestCgroupsLCEResourcesHandler.java


示例8: testInit

import org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor; //导入依赖的package包/类
@Test
public void testInit() throws IOException {
  LinuxContainerExecutor mockLCE = new MockLinuxContainerExecutor();
  CustomCgroupsLCEResourceHandler handler =
      new CustomCgroupsLCEResourceHandler();
  YarnConfiguration conf = new YarnConfiguration();
  final int numProcessors = 4;
  ResourceCalculatorPlugin plugin =
      Mockito.mock(ResourceCalculatorPlugin.class);
  Mockito.doReturn(numProcessors).when(plugin).getNumProcessors();
  handler.setConf(conf);
  handler.initConfig();

  // create mock cgroup
  File cgroupDir = createMockCgroup();
  File cgroupMountDir = createMockCgroupMount(cgroupDir);

  // create mock mtab
  File mockMtab = createMockMTab(cgroupDir);

  // setup our handler and call init()
  handler.setMtabFile(mockMtab.getAbsolutePath());

  // check values
  // in this case, we're using all cpu so the files
  // shouldn't exist(because init won't create them
  handler.init(mockLCE, plugin);
  File periodFile = new File(cgroupMountDir, "cpu.cfs_period_us");
  File quotaFile = new File(cgroupMountDir, "cpu.cfs_quota_us");
  Assert.assertFalse(periodFile.exists());
  Assert.assertFalse(quotaFile.exists());

  // subset of cpu being used, files should be created
  conf
    .setInt(YarnConfiguration.NM_RESOURCE_PERCENTAGE_PHYSICAL_CPU_LIMIT, 75);
  handler.limits[0] = 100 * 1000;
  handler.limits[1] = 1000 * 1000;
  handler.init(mockLCE, plugin);
  int period = readIntFromFile(periodFile);
  int quota = readIntFromFile(quotaFile);
  Assert.assertEquals(100 * 1000, period);
  Assert.assertEquals(1000 * 1000, quota);

  // set cpu back to 100, quota should be -1
  conf.setInt(YarnConfiguration.NM_RESOURCE_PERCENTAGE_PHYSICAL_CPU_LIMIT,
    100);
  handler.limits[0] = 100 * 1000;
  handler.limits[1] = 1000 * 1000;
  handler.init(mockLCE, plugin);
  quota = readIntFromFile(quotaFile);
  Assert.assertEquals(-1, quota);

  FileUtils.deleteQuietly(cgroupDir);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:55,代码来源:TestCgroupsLCEResourcesHandler.java


示例9: init

import org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor; //导入依赖的package包/类
public void init(LinuxContainerExecutor lce) throws IOException {
  this.init(lce,
      ResourceCalculatorPlugin.getResourceCalculatorPlugin(null, conf));
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:5,代码来源:CgroupsLCEResourcesHandlerGPU.java


示例10: init

import org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor; //导入依赖的package包/类
void init(LinuxContainerExecutor lce) throws IOException; 
开发者ID:naver,项目名称:hadoop,代码行数:2,代码来源:LCEResourcesHandler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BaseTestsOutputConsoleView类代码示例发布时间:2022-05-22
下一篇:
Java ValueShape类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap