import org.apache.hadoop.yarn.logaggregation.LogAggregationUtils; //导入方法依赖的package包/类
private Path createAppDir(String user, String applicationId,
UserGroupInformation userUgi, Configuration conf,
Path remoteNodeTmpLogFileForApp) throws IOException {
FileSystem remoteFS = FileSystem.get(conf);
// Only creating directories if they are missing to avoid
// unnecessary load on the filesystem from all of the nodes
String remoteRootLogDirSuffix = conf.get(
YarnConfiguration.NM_REMOTE_APP_LOG_DIR_SUFFIX,
YarnConfiguration.DEFAULT_NM_REMOTE_APP_LOG_DIR_SUFFIX);
Path appDir = LogAggregationUtils.getRemoteAppLogDir(
remoteNodeTmpLogFileForApp,
ConverterUtils.toApplicationId(applicationId), user,
remoteRootLogDirSuffix);
appDir = appDir.makeQualified(remoteFS.getUri(),
remoteFS.getWorkingDirectory());
if (!checkExists(remoteFS, appDir, APP_DIR_PERMISSIONS)) {
Path suffixDir = LogAggregationUtils.getRemoteLogSuffixedDir(
remoteNodeTmpLogFileForApp, user, remoteRootLogDirSuffix);
suffixDir = suffixDir.makeQualified(remoteFS.getUri(),
remoteFS.getWorkingDirectory());
if (!checkExists(remoteFS, suffixDir, APP_DIR_PERMISSIONS)) {
Path userDir = LogAggregationUtils.getRemoteLogUserDir(
remoteNodeTmpLogFileForApp, user);
userDir = userDir.makeQualified(remoteFS.getUri(),
remoteFS.getWorkingDirectory());
if (!checkExists(remoteFS, userDir, APP_DIR_PERMISSIONS)) {
createDir(remoteFS, userDir, APP_DIR_PERMISSIONS);
}
createDir(remoteFS, suffixDir, APP_DIR_PERMISSIONS);
}
createDir(remoteFS, appDir, APP_DIR_PERMISSIONS);
}
return appDir;
}