@InterfaceAudience.Public @InterfaceStability.Unstable public abstract class LogAggregationFileController extends Object
Modifier and Type | Field and Description |
---|---|
protected static FsPermission |
APP_DIR_PERMISSIONS
Permissions for the Application directory.
|
protected static FsPermission |
APP_LOG_FILE_UMASK
Umask for the log file.
|
protected Configuration |
conf |
protected String |
fileControllerName |
protected boolean |
fsSupportsChmod |
static String |
LOG_AGGREGATION_FS_SUPPORT_APPEND |
protected Path |
remoteRootLogDir |
protected String |
remoteRootLogDirSuffix |
protected int |
retentionSize |
protected static FsPermission |
TLDIR_PERMISSIONS
Permissions for the top level directory under which app directories will be
created.
|
Constructor and Description |
---|
LogAggregationFileController() |
Modifier and Type | Method and Description |
---|---|
protected String |
aggregatedLogSuffix(String fileName)
Create the aggregated log suffix.
|
protected boolean |
checkExists(FileSystem fs,
Path path,
FsPermission fsPerm) |
protected void |
cleanOldLogs(Path remoteNodeLogFileForApp,
NodeId nodeId,
UserGroupInformation userUgi) |
protected void |
closePrintStream(OutputStream out) |
abstract void |
closeWriter()
Close the writer.
|
void |
createAppDir(String user,
ApplicationId appId,
UserGroupInformation userUgi)
Create remote Application directory for log aggregation.
|
protected void |
createDir(FileSystem fs,
Path path,
FsPermission fsPerm) |
abstract Map<ApplicationAccessType,String> |
getApplicationAcls(Path aggregatedLogPath,
ApplicationId appId)
Returns ACLs for the application.
|
abstract String |
getApplicationOwner(Path aggregatedLogPath,
ApplicationId appId)
Returns the owner of the application.
|
protected FileSystem |
getFileSystem(Configuration conf) |
Path |
getOlderRemoteAppLogDir(ApplicationId appId,
String appOwner)
Get the older remote application directory for log aggregation.
|
Path |
getRemoteAppLogDir(ApplicationId appId,
String appOwner)
Get the remote application directory for log aggregation.
|
Path |
getRemoteNodeLogFileForApp(ApplicationId appId,
String user,
NodeId nodeId)
Get the remote aggregated log path.
|
Path |
getRemoteRootLogDir()
Get the remote root log directory.
|
String |
getRemoteRootLogDirSuffix()
Get the log aggregation directory suffix.
|
void |
initialize(Configuration conf,
String controllerName)
Initialize the log file controller.
|
abstract void |
initializeWriter(org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerContext context)
Initialize the writer.
|
protected abstract void |
initInternal(Configuration conf)
Derived classes initialize themselves using this method.
|
boolean |
isFsSupportsChmod() |
abstract void |
postWrite(org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerContext record)
Operations needed after write the log content.
|
abstract boolean |
readAggregatedLogs(org.apache.hadoop.yarn.logaggregation.ContainerLogsRequest logRequest,
OutputStream os)
Output container log.
|
abstract List<org.apache.hadoop.yarn.logaggregation.ContainerLogMeta> |
readAggregatedLogsMeta(org.apache.hadoop.yarn.logaggregation.ContainerLogsRequest logRequest)
Return a list of
ContainerLogMeta for an application
from Remote FileSystem. |
abstract void |
renderAggregatedLogsBlock(org.apache.hadoop.yarn.webapp.view.HtmlBlock.Block html,
org.apache.hadoop.yarn.webapp.View.ViewContext context)
Render Aggregated Logs block.
|
void |
verifyAndCreateRemoteLogDir()
Verify and create the remote log directory.
|
abstract void |
write(AggregatedLogFormat.LogKey logKey,
org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogValue logValue)
Write the log content.
|
protected static final FsPermission TLDIR_PERMISSIONS
protected static final FsPermission APP_DIR_PERMISSIONS
protected static final FsPermission APP_LOG_FILE_UMASK
public static final String LOG_AGGREGATION_FS_SUPPORT_APPEND
protected Configuration conf
protected Path remoteRootLogDir
protected String remoteRootLogDirSuffix
protected int retentionSize
protected String fileControllerName
protected boolean fsSupportsChmod
public void initialize(Configuration conf, String controllerName)
conf
- the ConfigurationcontrollerName
- the log controller class nameprotected abstract void initInternal(Configuration conf)
conf
- the Configurationpublic Path getRemoteRootLogDir()
public String getRemoteRootLogDirSuffix()
public abstract void initializeWriter(org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerContext context) throws IOException
context
- the LogAggregationFileControllerContext
IOException
- if fails to initialize the writerpublic abstract void closeWriter() throws org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationDFSException
org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationDFSException
- if the closing of the writer fails
(for example due to HDFS quota being exceeded)public abstract void write(AggregatedLogFormat.LogKey logKey, org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogValue logValue) throws IOException
logKey
- the log keylogValue
- the log contentIOException
- if fails to write the logspublic abstract void postWrite(org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerContext record) throws Exception
record
- the LogAggregationFileControllerContext
Exception
- if anything failsprotected void closePrintStream(OutputStream out)
public abstract boolean readAggregatedLogs(org.apache.hadoop.yarn.logaggregation.ContainerLogsRequest logRequest, OutputStream os) throws IOException
logRequest
- ContainerLogsRequest
os
- the output streamIOException
- if we can not access the log file.public abstract List<org.apache.hadoop.yarn.logaggregation.ContainerLogMeta> readAggregatedLogsMeta(org.apache.hadoop.yarn.logaggregation.ContainerLogsRequest logRequest) throws IOException
ContainerLogMeta
for an application
from Remote FileSystem.logRequest
- ContainerLogsRequest
ContainerLogMeta
IOException
- if there is no available log filepublic abstract void renderAggregatedLogsBlock(org.apache.hadoop.yarn.webapp.view.HtmlBlock.Block html, org.apache.hadoop.yarn.webapp.View.ViewContext context)
html
- the htmlcontext
- the ViewContextpublic abstract String getApplicationOwner(Path aggregatedLogPath, ApplicationId appId) throws IOException
aggregatedLogPath
- the aggregatedLog pathappId
- the ApplicationIdIOException
- if we can not get the application ownerpublic abstract Map<ApplicationAccessType,String> getApplicationAcls(Path aggregatedLogPath, ApplicationId appId) throws IOException
aggregatedLogPath
- the aggregatedLog path.appId
- the ApplicationIdIOException
- if we can not get the application aclspublic void verifyAndCreateRemoteLogDir()
public void createAppDir(String user, ApplicationId appId, UserGroupInformation userUgi)
user
- the userappId
- the application IDuserUgi
- the UGIprotected FileSystem getFileSystem(Configuration conf) throws IOException
IOException
protected void createDir(FileSystem fs, Path path, FsPermission fsPerm) throws IOException
IOException
protected boolean checkExists(FileSystem fs, Path path, FsPermission fsPerm) throws IOException
IOException
public Path getRemoteNodeLogFileForApp(ApplicationId appId, String user, NodeId nodeId)
appId
- the ApplicationIduser
- the Application OwnernodeId
- the NodeManager Idpublic Path getRemoteAppLogDir(ApplicationId appId, String appOwner) throws IOException
appId
- the Application IDappOwner
- the Application OwnerIOException
- if can not find the remote application directorypublic Path getOlderRemoteAppLogDir(ApplicationId appId, String appOwner) throws IOException
appId
- the Application IDappOwner
- the Application OwnerIOException
- if can not find the remote application directoryprotected void cleanOldLogs(Path remoteNodeLogFileForApp, NodeId nodeId, UserGroupInformation userUgi)
protected String aggregatedLogSuffix(String fileName)
fileName
- the File Namepublic boolean isFsSupportsChmod()
Copyright © 2019 Apache Software Foundation. All rights reserved.