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


Java LocalDirsHandlerService.getLogDirs方法代码示例

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


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

示例1: testDirFailuresOnStartup

import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService; //导入方法依赖的package包/类
/**
 * Make a local and log directory inaccessible during initialization
 * and verify those bad directories are recognized and removed from
 * the list of available local and log directories.
 * @throws IOException
 */
@Test
public void testDirFailuresOnStartup() throws IOException {
  Configuration conf = new YarnConfiguration();
  String localDir1 = new File(testDir, "localDir1").getPath();
  String localDir2 = new File(testDir, "localDir2").getPath();
  String logDir1 = new File(testDir, "logDir1").getPath();
  String logDir2 = new File(testDir, "logDir2").getPath();
  conf.set(YarnConfiguration.NM_LOCAL_DIRS, localDir1 + "," + localDir2);
  conf.set(YarnConfiguration.NM_LOG_DIRS, logDir1 + "," + logDir2);

  prepareDirToFail(localDir1);
  prepareDirToFail(logDir2);

  LocalDirsHandlerService dirSvc = new LocalDirsHandlerService();
  dirSvc.init(conf);
  List<String> localDirs = dirSvc.getLocalDirs();
  Assert.assertEquals(1, localDirs.size());
  Assert.assertEquals(new Path(localDir2).toString(), localDirs.get(0));
  List<String> logDirs = dirSvc.getLogDirs();
  Assert.assertEquals(1, logDirs.size());
  Assert.assertEquals(new Path(logDir1).toString(), logDirs.get(0));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestDiskFailures.java

示例2: getContainerLogDirs

import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService; //导入方法依赖的package包/类
static List<File> getContainerLogDirs(ContainerId containerId,
    LocalDirsHandlerService dirsHandler) {
  List<String> logDirs = dirsHandler.getLogDirs();
  List<File> containerLogDirs = new ArrayList<File>(logDirs.size());
  for (String logDir : logDirs) {
    try {
      logDir = new URI(logDir).getPath();
    } catch (URISyntaxException e) {
      Log.warn(e.getMessage());
    }
    String appIdStr = ConverterUtils.toString(containerId
        .getApplicationAttemptId().getApplicationId());
    File appLogDir = new File(logDir, appIdStr);
    String containerIdStr = ConverterUtils.toString(containerId);
    containerLogDirs.add(new File(appLogDir, containerIdStr));
  }
  return containerLogDirs;
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:19,代码来源:ContainerLogsPage.java

示例3: getContainerLogDirs

import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService; //导入方法依赖的package包/类
static List<File> getContainerLogDirs(ContainerId containerId,
    LocalDirsHandlerService dirsHandler) throws YarnException {
  List<String> logDirs = dirsHandler.getLogDirs();
  List<File> containerLogDirs = new ArrayList<File>(logDirs.size());
  for (String logDir : logDirs) {
    logDir = new File(logDir).toURI().getPath();
    String appIdStr = ConverterUtils.toString(containerId
        .getApplicationAttemptId().getApplicationId());
    File appLogDir = new File(logDir, appIdStr);
    containerLogDirs.add(new File(appLogDir, containerId.toString()));
  }
  return containerLogDirs;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:14,代码来源:ContainerLogsUtils.java


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