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


Java ContainersLogsBlock类代码示例

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


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

示例1: testContainerLogDirs

import org.apache.hadoop.yarn.server.nodemanager.webapp.ContainerLogsPage.ContainersLogsBlock; //导入依赖的package包/类
@Test(timeout=30000)
public void testContainerLogDirs() throws IOException {
  File absLogDir = new File("target",
    TestNMWebServer.class.getSimpleName() + "LogDir").getAbsoluteFile();
  String logdirwithFile = absLogDir.toURI().toString();
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.NM_LOG_DIRS, logdirwithFile);
  NodeHealthCheckerService healthChecker = new NodeHealthCheckerService();
  healthChecker.init(conf);
  LocalDirsHandlerService dirsHandler = healthChecker.getDiskHandler();
  // Add an application and the corresponding containers
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(conf);
  String user = "nobody";
  long clusterTimeStamp = 1234;
  ApplicationId appId = BuilderUtils.newApplicationId(recordFactory,
      clusterTimeStamp, 1);
  Application app = mock(Application.class);
  when(app.getUser()).thenReturn(user);
  when(app.getAppId()).thenReturn(appId);
  ApplicationAttemptId appAttemptId = BuilderUtils.newApplicationAttemptId(
      appId, 1);
  ContainerId container1 = BuilderUtils.newContainerId(recordFactory, appId,
      appAttemptId, 0);
  List<File> files = null;
  files = ContainerLogsPage.ContainersLogsBlock.getContainerLogDirs(
      container1, dirsHandler);
  Assert.assertTrue(!(files.get(0).toString().contains("file:")));
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:29,代码来源:TestContainerLogsPage.java


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