public AuxServices(AuxiliaryLocalPathHandler auxiliaryLocalPathHandler, Context nmContext, DeletionService deletionService) { super(AuxServices.class.getName()); serviceMap = Collections.synchronizedMap(new HashMap<String,AuxiliaryService>()); serviceMetaData = Collections.synchronizedMap(new HashMap<String,ByteBuffer>()); this.auxiliaryLocalPathHandler = auxiliaryLocalPathHandler; this.dirsHandler = nmContext.getLocalDirsHandler(); this.delService = deletionService; this.userUGI = getRemoteUgi(); // Obtain services from configuration in init() }
private File locatePidFile(String appIdStr, String containerIdStr) { String pidSubpath= getPidFileSubpath(appIdStr, containerIdStr); for (String dir : getContext().getLocalDirsHandler(). getLocalDirsForRead()) { File pidFile = new File(dir, pidSubpath); if (pidFile.exists()) { return pidFile; } } return null; } }
private File locatePidFile(String appIdStr, String containerIdStr) { String pidSubpath= getPidFileSubpath(appIdStr, containerIdStr); for (String dir : getContext().getLocalDirsHandler(). getLocalDirsForRead()) { File pidFile = new File(dir, pidSubpath); if (pidFile.exists()) { return pidFile; } } return null; } }
private File locatePidFile(String appIdStr, String containerIdStr) { String pidSubpath= getPidFileSubpath(appIdStr, containerIdStr); for (String dir : getContext().getLocalDirsHandler(). getLocalDirsForRead()) { File pidFile = new File(dir, pidSubpath); if (pidFile.exists()) { return pidFile; } } return null; } }
private File locatePidFile(String appIdStr, String containerIdStr) { String pidSubpath= getPidFileSubpath(appIdStr, containerIdStr); for (String dir : getContext().getLocalDirsHandler(). getLocalDirsForRead()) { File pidFile = new File(dir, pidSubpath); if (pidFile.exists()) { return pidFile; } } return null; } }
private File locatePidFile(String appIdStr, String containerIdStr) { String pidSubpath= getPidFileSubpath(appIdStr, containerIdStr); for (String dir : getContext().getLocalDirsHandler(). getLocalDirsForRead()) { File pidFile = new File(dir, pidSubpath); if (pidFile.exists()) { return pidFile; } } return null; } }
containerId.getApplicationAttemptId().getApplicationId(); Application app = nmContext.getApplications().get(appId); Configuration nmConf = nmContext.getLocalDirsHandler().getConfig(); if (app == null && nmConf.getBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED,
File cmdDir = null; if(nmContext == null || nmContext.getLocalDirsHandler() == null) { throw new ContainerExecutionException( "Unable to write temporary docker command"); String cmdDirPath = nmContext.getLocalDirsHandler().getLocalPathForWrite( ResourceLocalizationService.NM_PRIVATE_DIR + Path.SEPARATOR + appId + Path.SEPARATOR + filePrefix + Path.SEPARATOR).toString();
Configuration nmConf = nmContext.getLocalDirsHandler().getConfig(); if ((app == null || fetchAggregatedLog) && nmConf.getBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED,
/** * 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."); } }
/** * 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."); } }
/** * 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."); } }
/** * 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."); } }
/** * Finds the local directories that logs for the given container are stored * on. */ public static List<File> getContainerLogDirs(ContainerId containerId, String remoteUser, Context context) throws YarnException { Container container = context.getContainers().get(containerId); Application application = getApplicationForContainer(containerId, context); checkAccess(remoteUser, application, context); // It is not required to have null check for container ( container == null ) // and throw back exception.Because when container is completed, NodeManager // remove container information from its NMContext.Configuring log // aggregation to false, container log view request is forwarded to NM. NM // does not have completed container information,but still NM serve request for // reading container logs. if (container != null) { checkState(container.getContainerState()); } return getContainerLogDirs(containerId, context.getLocalDirsHandler()); }
/** * Finds the local directories that logs for the given container are stored * on. */ public static List<File> getContainerLogDirs(ContainerId containerId, String remoteUser, Context context) throws YarnException { Container container = context.getContainers().get(containerId); Application application = getApplicationForContainer(containerId, context); checkAccess(remoteUser, application, context); // It is not required to have null check for container ( container == null ) // and throw back exception.Because when container is completed, NodeManager // remove container information from its NMContext.Configuring log // aggregation to false, container log view request is forwarded to NM. NM // does not have completed container information,but still NM serve request for // reading container logs. if (container != null) { checkState(container.getContainerState()); } return getContainerLogDirs(containerId, context.getLocalDirsHandler()); }
/** * Finds the local directories that logs for the given container are stored * on. */ public static List<File> getContainerLogDirs(ContainerId containerId, String remoteUser, Context context) throws YarnException { Container container = context.getContainers().get(containerId); Application application = getApplicationForContainer(containerId, context); checkAccess(remoteUser, application, context); // It is not required to have null check for container ( container == null ) // and throw back exception.Because when container is completed, NodeManager // remove container information from its NMContext.Configuring log // aggregation to false, container log view request is forwarded to NM. NM // does not have completed container information,but still NM serve request for // reading container logs. if (container != null) { checkState(container.getContainerState()); } return getContainerLogDirs(containerId, context.getLocalDirsHandler()); }
/** * Finds the local directories that logs for the given container are stored * on. */ public static List<File> getContainerLogDirs(ContainerId containerId, String remoteUser, Context context) throws YarnException { Container container = context.getContainers().get(containerId); Application application = getApplicationForContainer(containerId, context); checkAccess(remoteUser, application, context); // It is not required to have null check for container ( container == null ) // and throw back exception.Because when container is completed, NodeManager // remove container information from its NMContext.Configuring log // aggregation to false, container log view request is forwarded to NM. NM // does not have completed container information,but still NM serve request for // reading container logs. if (container != null) { checkState(container.getContainerState()); } return getContainerLogDirs(containerId, context.getLocalDirsHandler()); }