本文整理汇总了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.");
}
}
示例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.");
}
}