LogAggregationIndexedFileController, LogAggregationNodeLocalTFileController, LogAggregationTFileController@Public
@Unstable
public abstract class LogAggregationFileController
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
protected static org.apache.hadoop.fs.permission.FsPermission |
APP_DIR_PERMISSIONS |
Permissions for the Application directory.
|
protected static org.apache.hadoop.fs.permission.FsPermission |
APP_LOG_FILE_UMASK |
Umask for the log file.
|
protected org.apache.hadoop.conf.Configuration |
conf |
|
protected java.lang.String |
fileControllerName |
|
protected boolean |
fsSupportsChmod |
|
protected int |
maxRetry |
|
protected java.lang.String |
remoteOlderRootLogDirSuffix |
|
protected org.apache.hadoop.fs.Path |
remoteRootLogDir |
|
protected java.lang.String |
remoteRootLogDirSuffix |
|
protected int |
retentionSize |
|
protected long |
retryTimeout |
|
protected static org.apache.hadoop.fs.permission.FsPermission |
TLDIR_PERMISSIONS |
Permissions for the top level directory under which app directories will be
created.
|
protected org.apache.hadoop.security.authorize.UsersACLsManager |
usersAclsManager |
| Constructor | Description |
|---|---|
LogAggregationFileController() |
| Modifier and Type | Method | Description |
|---|---|---|
protected java.lang.String |
aggregatedLogSuffix(java.lang.String fileName) |
Create the aggregated log suffix.
|
protected boolean |
belongsToAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId,
java.lang.String containerIdStr) |
|
protected boolean |
checkExists(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission fsPerm) |
|
protected void |
cleanOldLogs(org.apache.hadoop.fs.Path remoteNodeLogFileForApp,
org.apache.hadoop.yarn.api.records.NodeId nodeId,
org.apache.hadoop.security.UserGroupInformation userUgi) |
|
protected void |
closePrintStream(java.io.OutputStream out) |
|
abstract void |
closeWriter() |
Close the writer.
|
void |
createAppDir(java.lang.String user,
org.apache.hadoop.yarn.api.records.ApplicationId appId,
org.apache.hadoop.security.UserGroupInformation userUgi) |
Create remote Application directory for log aggregation.
|
protected void |
createDir(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission fsPerm) |
|
protected void |
extractRemoteOlderRootLogDirSuffix() |
Sets the remoteRootOlderLogDirSuffix class variable extracting
YarnConfiguration.LOG_AGGREGATION_REMOTE_APP_LOG_DIR_SUFFIX_FMT
from the configuration, or
YarnConfiguration.NM_REMOTE_APP_LOG_DIR_SUFFIX |
protected void |
extractRemoteRootLogDir() |
Sets the remoteRootLogDir class variable extracting
YarnConfiguration.LOG_AGGREGATION_REMOTE_APP_LOG_DIR_FMT
from the configuration or YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
if the former is not set. |
protected void |
extractRemoteRootLogDirSuffix() |
Sets the remoteRootLogDirSuffix class variable extracting
YarnConfiguration.LOG_AGGREGATION_REMOTE_APP_LOG_DIR_SUFFIX_FMT
from the configuration, or
YarnConfiguration.NM_REMOTE_APP_LOG_DIR_SUFFIX appended by the
FileController's name, if the former is not set. |
abstract java.util.Map<org.apache.hadoop.yarn.api.records.ApplicationAccessType,java.lang.String> |
getApplicationAcls(org.apache.hadoop.fs.Path aggregatedLogPath,
org.apache.hadoop.yarn.api.records.ApplicationId appId) |
Returns ACLs for the application.
|
org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.FileStatus> |
getApplicationDirectoriesOfUser(java.lang.String user) |
Gets all application directories of a user.
|
abstract java.lang.String |
getApplicationOwner(org.apache.hadoop.fs.Path aggregatedLogPath,
org.apache.hadoop.yarn.api.records.ApplicationId appId) |
Returns the owner of the application.
|
java.lang.String |
getFileControllerName() |
Get the name of the file controller.
|
protected org.apache.hadoop.fs.FileSystem |
getFileSystem(org.apache.hadoop.conf.Configuration conf) |
|
java.util.Map<java.lang.String,java.util.List<ContainerLogFileInfo>> |
getLogMetaFilesOfNode(ExtendedLogMetaRequest logRequest,
org.apache.hadoop.fs.FileStatus currentNodeFile,
org.apache.hadoop.yarn.api.records.ApplicationId appId) |
Returns log file metadata for a node grouped by containers.
|
org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.FileStatus> |
getNodeFilesOfApplicationDirectory(org.apache.hadoop.fs.FileStatus appDir) |
Gets all node files in an application directory.
|
org.apache.hadoop.fs.Path |
getOlderRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId,
java.lang.String appOwner) |
Get the older remote application directory for log aggregation.
|
org.apache.hadoop.fs.Path |
getRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId,
java.lang.String appOwner) |
Get the remote application directory for log aggregation.
|
org.apache.hadoop.fs.Path |
getRemoteNodeLogFileForApp(org.apache.hadoop.yarn.api.records.ApplicationId appId,
java.lang.String user,
org.apache.hadoop.yarn.api.records.NodeId nodeId) |
Get the remote aggregated log path.
|
java.lang.String |
getRemoteOlderRootLogDirSuffix() |
Get the log aggregation directory suffix.
|
org.apache.hadoop.fs.Path |
getRemoteRootLogDir() |
Get the remote root log directory.
|
java.lang.String |
getRemoteRootLogDirSuffix() |
Get the log aggregation directory suffix.
|
void |
initialize(org.apache.hadoop.conf.Configuration conf,
java.lang.String controllerName) |
Initialize the log file controller.
|
abstract void |
initializeWriter(LogAggregationFileControllerContext context) |
Initialize the writer.
|
protected abstract void |
initInternal(org.apache.hadoop.conf.Configuration conf) |
Derived classes initialize themselves using this method.
|
boolean |
isFsSupportsChmod() |
|
abstract void |
postWrite(LogAggregationFileControllerContext record) |
Operations needed after write the log content.
|
abstract boolean |
readAggregatedLogs(ContainerLogsRequest logRequest,
java.io.OutputStream os) |
Output container log.
|
abstract java.util.List<ContainerLogMeta> |
readAggregatedLogsMeta(ContainerLogsRequest logRequest) |
Return a list of
ContainerLogMeta for an application
from Remote FileSystem. |
abstract void |
renderAggregatedLogsBlock(HtmlBlock.Block html,
View.ViewContext context) |
Render Aggregated Logs block.
|
void |
verifyAndCreateRemoteLogDir() |
Verify and create the remote log directory.
|
abstract void |
write(AggregatedLogFormat.LogKey logKey,
AggregatedLogFormat.LogValue logValue) |
Write the log content.
|
protected static final org.apache.hadoop.fs.permission.FsPermission TLDIR_PERMISSIONS
protected static final org.apache.hadoop.fs.permission.FsPermission APP_DIR_PERMISSIONS
protected static final org.apache.hadoop.fs.permission.FsPermission APP_LOG_FILE_UMASK
protected org.apache.hadoop.conf.Configuration conf
protected org.apache.hadoop.fs.Path remoteRootLogDir
protected java.lang.String remoteRootLogDirSuffix
protected java.lang.String remoteOlderRootLogDirSuffix
protected int retentionSize
protected java.lang.String fileControllerName
protected boolean fsSupportsChmod
protected org.apache.hadoop.security.authorize.UsersACLsManager usersAclsManager
protected int maxRetry
protected long retryTimeout
public void initialize(org.apache.hadoop.conf.Configuration conf,
java.lang.String controllerName)
conf - the ConfigurationcontrollerName - the log controller class nameprotected abstract void initInternal(org.apache.hadoop.conf.Configuration conf)
conf - the Configurationpublic org.apache.hadoop.fs.Path getRemoteRootLogDir()
public java.lang.String getRemoteRootLogDirSuffix()
public java.lang.String getFileControllerName()
public java.lang.String getRemoteOlderRootLogDirSuffix()
public abstract void initializeWriter(LogAggregationFileControllerContext context) throws java.io.IOException
context - the LogAggregationFileControllerContextjava.io.IOException - if fails to initialize the writerpublic abstract void closeWriter()
throws LogAggregationDFSException
LogAggregationDFSException - if the closing of the writer fails
(for example due to HDFS quota being exceeded)public abstract void write(AggregatedLogFormat.LogKey logKey, AggregatedLogFormat.LogValue logValue) throws java.io.IOException
logKey - the log keylogValue - the log contentjava.io.IOException - if fails to write the logspublic abstract void postWrite(LogAggregationFileControllerContext record) throws java.lang.Exception
record - the LogAggregationFileControllerContextjava.lang.Exception - if anything failsprotected void closePrintStream(java.io.OutputStream out)
public abstract boolean readAggregatedLogs(ContainerLogsRequest logRequest, java.io.OutputStream os) throws java.io.IOException
logRequest - ContainerLogsRequestos - the output streamjava.io.IOException - if we can not access the log file.public abstract java.util.List<ContainerLogMeta> readAggregatedLogsMeta(ContainerLogsRequest logRequest) throws java.io.IOException
ContainerLogMeta for an application
from Remote FileSystem.logRequest - ContainerLogsRequestContainerLogMetajava.io.IOException - if there is no available log filepublic java.util.Map<java.lang.String,java.util.List<ContainerLogFileInfo>> getLogMetaFilesOfNode(ExtendedLogMetaRequest logRequest, org.apache.hadoop.fs.FileStatus currentNodeFile, org.apache.hadoop.yarn.api.records.ApplicationId appId) throws java.io.IOException
logRequest - extended query information holdercurrentNodeFile - file status of a node in an application directoryappId - id of the application, which is the same as in node pathjava.io.IOException - if there is no node filepublic org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.FileStatus> getApplicationDirectoriesOfUser(java.lang.String user)
throws java.io.IOException
user - name of the userjava.io.IOException - if user directory does not existpublic org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.FileStatus> getNodeFilesOfApplicationDirectory(org.apache.hadoop.fs.FileStatus appDir)
throws java.io.IOException
appDir - application directoryjava.io.IOException - if file context is not reachablepublic abstract void renderAggregatedLogsBlock(HtmlBlock.Block html, View.ViewContext context)
html - the htmlcontext - the ViewContextpublic abstract java.lang.String getApplicationOwner(org.apache.hadoop.fs.Path aggregatedLogPath,
org.apache.hadoop.yarn.api.records.ApplicationId appId)
throws java.io.IOException
aggregatedLogPath - the aggregatedLog pathappId - the ApplicationIdjava.io.IOException - if we can not get the application ownerpublic abstract java.util.Map<org.apache.hadoop.yarn.api.records.ApplicationAccessType,java.lang.String> getApplicationAcls(org.apache.hadoop.fs.Path aggregatedLogPath,
org.apache.hadoop.yarn.api.records.ApplicationId appId)
throws java.io.IOException
aggregatedLogPath - the aggregatedLog path.appId - the ApplicationIdjava.io.IOException - if we can not get the application aclsprotected void extractRemoteRootLogDirSuffix()
YarnConfiguration.LOG_AGGREGATION_REMOTE_APP_LOG_DIR_SUFFIX_FMT
from the configuration, or
YarnConfiguration.NM_REMOTE_APP_LOG_DIR_SUFFIX appended by the
FileController's name, if the former is not set.protected void extractRemoteOlderRootLogDirSuffix()
YarnConfiguration.LOG_AGGREGATION_REMOTE_APP_LOG_DIR_SUFFIX_FMT
from the configuration, or
YarnConfiguration.NM_REMOTE_APP_LOG_DIR_SUFFIXprotected void extractRemoteRootLogDir()
YarnConfiguration.LOG_AGGREGATION_REMOTE_APP_LOG_DIR_FMT
from the configuration or YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
if the former is not set.public void verifyAndCreateRemoteLogDir()
public void createAppDir(java.lang.String user,
org.apache.hadoop.yarn.api.records.ApplicationId appId,
org.apache.hadoop.security.UserGroupInformation userUgi)
user - the userappId - the application IDuserUgi - the UGI@VisibleForTesting
protected org.apache.hadoop.fs.FileSystem getFileSystem(org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
java.io.IOExceptionprotected void createDir(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission fsPerm)
throws java.io.IOException
java.io.IOExceptionprotected boolean checkExists(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.fs.permission.FsPermission fsPerm)
throws java.io.IOException
java.io.IOExceptionpublic org.apache.hadoop.fs.Path getRemoteNodeLogFileForApp(org.apache.hadoop.yarn.api.records.ApplicationId appId,
java.lang.String user,
org.apache.hadoop.yarn.api.records.NodeId nodeId)
appId - the ApplicationIduser - the Application OwnernodeId - the NodeManager Idpublic org.apache.hadoop.fs.Path getRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId,
java.lang.String appOwner)
throws java.io.IOException
appId - the Application IDappOwner - the Application Ownerjava.io.IOException - if can not find the remote application directorypublic org.apache.hadoop.fs.Path getOlderRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId,
java.lang.String appOwner)
throws java.io.IOException
appId - the Application IDappOwner - the Application Ownerjava.io.IOException - if can not find the remote application directoryprotected void cleanOldLogs(org.apache.hadoop.fs.Path remoteNodeLogFileForApp,
org.apache.hadoop.yarn.api.records.NodeId nodeId,
org.apache.hadoop.security.UserGroupInformation userUgi)
protected java.lang.String aggregatedLogSuffix(java.lang.String fileName)
fileName - the File Namepublic boolean isFsSupportsChmod()
protected boolean belongsToAppAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId,
java.lang.String containerIdStr)
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.