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


Java LocalDirsHandlerService.getLogPathToRead方法代码示例

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


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

示例1: getContainerLogFile

import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService; //导入方法依赖的package包/类
/**
 * Finds the log file with the given filename for the given container.
 */
public static File getContainerLogFile(ContainerId containerId,
    String fileName, String remoteUser, Context context) throws YarnException {
  Container container = context.getContainers().get(containerId);
  
  Application application = getApplicationForContainer(containerId, context);
  checkAccess(remoteUser, application, context);
  if (container != null) {
    checkState(container.getContainerState());
  }
  
  try {
    LocalDirsHandlerService dirsHandler = context.getLocalDirsHandler();
    String relativeContainerLogDir = ContainerLaunch.getRelativeContainerLogDir(
        application.getAppId().toString(), containerId.toString());
    Path logPath = dirsHandler.getLogPathToRead(
        relativeContainerLogDir + Path.SEPARATOR + fileName);
    URI logPathURI = new File(logPath.toString()).toURI();
    File logFile = new File(logPathURI.getPath());
    return logFile;
  } catch (IOException e) {
    LOG.warn("Failed to find log file", e);
    throw new NotFoundException("Cannot find this log on the local disk.");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:ContainerLogsUtils.java

示例2: getContainerLogFile

import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService; //导入方法依赖的package包/类
/**
 * Finds the log file with the given filename for the given container.
 */
public static File getContainerLogFile(ContainerId containerId,
    String fileName, String remoteUser, Context context, String userFolder) throws YarnException {
  Container container = context.getContainers().get(containerId);
  
  Application application = getApplicationForContainer(containerId, context);
  checkAccess(remoteUser, application, context);
  if (container != null) {
    checkState(container.getContainerState());
  }
  
  try {
    LocalDirsHandlerService dirsHandler = context.getLocalDirsHandler();
    String relativeContainerLogDir = ContainerLaunch.getRelativeContainerLogDir(
        application.getAppId().toString(), containerId.toString(), userFolder);
    Path logPath = dirsHandler.getLogPathToRead(
        relativeContainerLogDir + Path.SEPARATOR + fileName);
    URI logPathURI = new File(logPath.toString()).toURI();
    File logFile = new File(logPathURI.getPath());
    return logFile;
  } catch (IOException e) {
    LOG.warn("Failed to find log file", e);
    throw new NotFoundException("Cannot find this log on the local disk.");
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:28,代码来源:ContainerLogsUtils.java


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