Class LogAggregationIndexedFileController
java.lang.Object
org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileController
org.apache.hadoop.yarn.logaggregation.filecontroller.ifile.LogAggregationIndexedFileController
@Private
@Unstable
public class LogAggregationIndexedFileController
extends LogAggregationFileController
The Indexed Log Aggregation File Format implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis IndexedFileLogMeta includes the meta information for a single file which would be aggregated in one Log aggregation cycle.static classThis IndexedLogsMeta includes all the meta information for the aggregated log file.static classThis IndexedPerAggregationLogMeta includes the meta information for all files which would be aggregated in one Log aggregation cycle. -
Field Summary
FieldsFields inherited from class org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileController
APP_DIR_PERMISSIONS, APP_LOG_FILE_UMASK, conf, fileControllerName, fsSupportsChmod, remoteRootLogDir, remoteRootLogDirSuffix, retentionSize, TLDIR_PERMISSIONS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClose the writer.org.apache.hadoop.fs.FileStatusgetAllChecksumFiles(Map<String, org.apache.hadoop.fs.FileStatus> fileMap, String fileName) getApplicationAcls(org.apache.hadoop.fs.Path aggregatedLogPath, org.apache.hadoop.yarn.api.records.ApplicationId appId) Returns ACLs for the application.getApplicationOwner(org.apache.hadoop.fs.Path aggregatedLogPath, org.apache.hadoop.yarn.api.records.ApplicationId appId) Returns the owner of the application.static intgetFSInputBufferSize(org.apache.hadoop.conf.Configuration conf) static intgetFSOutputBufferSize(org.apache.hadoop.conf.Configuration conf) 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.List<org.apache.hadoop.fs.FileStatus>getNodeLogFileToRead(List<org.apache.hadoop.fs.FileStatus> nodeFiles, String nodeId, org.apache.hadoop.yarn.api.records.ApplicationId appId) org.apache.hadoop.fs.PathgetOlderRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId, String user) Get the older remote application directory for log aggregation.org.apache.hadoop.fs.PathgetRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId, String user) Get the remote application directory for log aggregation.longgetRollOverLogMaxSize(org.apache.hadoop.conf.Configuration conf) voidInitialize the writer.voidinitInternal(org.apache.hadoop.conf.Configuration conf) Derived classes initialize themselves using this method.booleanisRollover(org.apache.hadoop.fs.FileContext fc, org.apache.hadoop.fs.Path candidate) loadIndexedLogsMeta(org.apache.hadoop.fs.Path remoteLogPath, long end, org.apache.hadoop.yarn.api.records.ApplicationId appId) parseCheckSumFiles(List<org.apache.hadoop.fs.FileStatus> fileList) voidOperations needed after write the log content.booleanreadAggregatedLogs(ContainerLogsRequest logRequest, OutputStream os) Output container log.readAggregatedLogsMeta(ContainerLogsRequest logRequest) Return a list ofContainerLogMetafor an application from Remote FileSystem.voidrenderAggregatedLogsBlock(HtmlBlock.Block html, View.ViewContext context) Render Aggregated Logs block.voidwrite(AggregatedLogFormat.LogKey logKey, AggregatedLogFormat.LogValue logValue) Write the log content.Methods inherited from class org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileController
aggregatedLogSuffix, belongsToAppAttempt, checkExists, cleanOldLogs, closePrintStream, createAppDir, createDir, getApplicationDirectoriesOfUser, getFileControllerName, getFileSystem, getNodeFilesOfApplicationDirectory, getRemoteNodeLogFileForApp, getRemoteRootLogDir, getRemoteRootLogDirSuffix, initialize, isFsSupportsChmod, verifyAndCreateRemoteLogDir
-
Field Details
-
CHECK_SUM_FILE_SUFFIX
- See Also:
-
-
Constructor Details
-
LogAggregationIndexedFileController
public LogAggregationIndexedFileController()
-
-
Method Details
-
initInternal
public void initInternal(org.apache.hadoop.conf.Configuration conf) Description copied from class:LogAggregationFileControllerDerived classes initialize themselves using this method.- Specified by:
initInternalin classLogAggregationFileController- Parameters:
conf- the Configuration
-
initializeWriter
Description copied from class:LogAggregationFileControllerInitialize the writer.- Specified by:
initializeWriterin classLogAggregationFileController- Parameters:
context- theLogAggregationFileControllerContext- Throws:
IOException- if fails to initialize the writer
-
closeWriter
public void closeWriter()Description copied from class:LogAggregationFileControllerClose the writer.- Specified by:
closeWriterin classLogAggregationFileController
-
write
public void write(AggregatedLogFormat.LogKey logKey, AggregatedLogFormat.LogValue logValue) throws IOException Description copied from class:LogAggregationFileControllerWrite the log content.- Specified by:
writein classLogAggregationFileController- Parameters:
logKey- the log keylogValue- the log content- Throws:
IOException- if fails to write the logs
-
postWrite
Description copied from class:LogAggregationFileControllerOperations needed after write the log content.- Specified by:
postWritein classLogAggregationFileController- Parameters:
record- theLogAggregationFileControllerContext- Throws:
Exception- if anything fails
-
readAggregatedLogs
public boolean readAggregatedLogs(ContainerLogsRequest logRequest, OutputStream os) throws IOException Description copied from class:LogAggregationFileControllerOutput container log.- Specified by:
readAggregatedLogsin classLogAggregationFileController- Parameters:
logRequest-ContainerLogsRequestos- the output stream- Returns:
- true if we can read the aggregated logs successfully
- Throws:
IOException- if we can not access the log file.
-
getLogMetaFilesOfNode
public Map<String,List<ContainerLogFileInfo>> getLogMetaFilesOfNode(ExtendedLogMetaRequest logRequest, org.apache.hadoop.fs.FileStatus currentNodeFile, org.apache.hadoop.yarn.api.records.ApplicationId appId) throws IOException Description copied from class:LogAggregationFileControllerReturns log file metadata for a node grouped by containers.- Overrides:
getLogMetaFilesOfNodein classLogAggregationFileController- Parameters:
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 path- Returns:
- log file metadata
- Throws:
IOException- if there is no node file
-
readAggregatedLogsMeta
public List<ContainerLogMeta> readAggregatedLogsMeta(ContainerLogsRequest logRequest) throws IOException Description copied from class:LogAggregationFileControllerReturn a list ofContainerLogMetafor an application from Remote FileSystem.- Specified by:
readAggregatedLogsMetain classLogAggregationFileController- Parameters:
logRequest-ContainerLogsRequest- Returns:
- a list of
ContainerLogMeta - Throws:
IOException- if there is no available log file
-
parseCheckSumFiles
@Private public Map<String,Long> parseCheckSumFiles(List<org.apache.hadoop.fs.FileStatus> fileList) throws IOException - Throws:
IOException
-
getNodeLogFileToRead
@Private public List<org.apache.hadoop.fs.FileStatus> getNodeLogFileToRead(List<org.apache.hadoop.fs.FileStatus> nodeFiles, String nodeId, org.apache.hadoop.yarn.api.records.ApplicationId appId) throws IOException - Throws:
IOException
-
getAllChecksumFiles
-
renderAggregatedLogsBlock
Description copied from class:LogAggregationFileControllerRender Aggregated Logs block.- Specified by:
renderAggregatedLogsBlockin classLogAggregationFileController- Parameters:
html- the htmlcontext- the ViewContext
-
getApplicationOwner
public String getApplicationOwner(org.apache.hadoop.fs.Path aggregatedLogPath, org.apache.hadoop.yarn.api.records.ApplicationId appId) throws IOException Description copied from class:LogAggregationFileControllerReturns the owner of the application.- Specified by:
getApplicationOwnerin classLogAggregationFileController- Parameters:
aggregatedLogPath- the aggregatedLog pathappId- the ApplicationId- Returns:
- the application owner
- Throws:
IOException- if we can not get the application owner
-
getApplicationAcls
public Map<org.apache.hadoop.yarn.api.records.ApplicationAccessType,String> getApplicationAcls(org.apache.hadoop.fs.Path aggregatedLogPath, org.apache.hadoop.yarn.api.records.ApplicationId appId) throws IOException Description copied from class:LogAggregationFileControllerReturns ACLs for the application. An empty map is returned if no ACLs are found.- Specified by:
getApplicationAclsin classLogAggregationFileController- Parameters:
aggregatedLogPath- the aggregatedLog path.appId- the ApplicationId- Returns:
- a map of the Application ACLs.
- Throws:
IOException- if we can not get the application acls
-
getRemoteAppLogDir
public org.apache.hadoop.fs.Path getRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId, String user) throws IOException Description copied from class:LogAggregationFileControllerGet the remote application directory for log aggregation.- Overrides:
getRemoteAppLogDirin classLogAggregationFileController- Parameters:
appId- the Application IDuser- the Application Owner- Returns:
- the remote application directory
- Throws:
IOException- if can not find the remote application directory
-
getOlderRemoteAppLogDir
public org.apache.hadoop.fs.Path getOlderRemoteAppLogDir(org.apache.hadoop.yarn.api.records.ApplicationId appId, String user) throws IOException Description copied from class:LogAggregationFileControllerGet the older remote application directory for log aggregation.- Overrides:
getOlderRemoteAppLogDirin classLogAggregationFileController- Parameters:
appId- the Application IDuser- the Application Owner- Returns:
- the older remote application directory
- Throws:
IOException- if can not find the remote application directory
-
loadIndexedLogsMeta
@Private public LogAggregationIndexedFileController.IndexedLogsMeta loadIndexedLogsMeta(org.apache.hadoop.fs.Path remoteLogPath, long end, org.apache.hadoop.yarn.api.records.ApplicationId appId) throws IOException - Throws:
IOException
-
getFSOutputBufferSize
@Private public static int getFSOutputBufferSize(org.apache.hadoop.conf.Configuration conf) -
getFSInputBufferSize
@Private public static int getFSInputBufferSize(org.apache.hadoop.conf.Configuration conf) -
getRollOverLogMaxSize
@Private @VisibleForTesting public long getRollOverLogMaxSize(org.apache.hadoop.conf.Configuration conf) -
isRollover
@Private @VisibleForTesting public boolean isRollover(org.apache.hadoop.fs.FileContext fc, org.apache.hadoop.fs.Path candidate) throws IOException - Throws:
IOException
-
getSystemClock
-