public abstract class ContainerLogUtils
extends java.lang.Object
Constructor and Description |
---|
ContainerLogUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getFileContent(java.io.File file)
Reads a file content and return it as String.
|
static java.util.List<org.springframework.core.io.Resource> |
queryContainerLogs(YarnCluster yarnCluster,
org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Find container logs for running cluster and application.
|
static java.util.List<org.springframework.core.io.Resource> |
queryContainerLogs(YarnCluster yarnCluster,
org.apache.hadoop.yarn.api.records.ApplicationId applicationId,
java.lang.String fileName)
Find container logs for running cluster and application.
|
public static java.util.List<org.springframework.core.io.Resource> queryContainerLogs(YarnCluster yarnCluster, org.apache.hadoop.yarn.api.records.ApplicationId applicationId, java.lang.String fileName) throws java.io.IOException
Created pattern which is used with PathMatchingResourcePatternResolver
is resolved from YarnCluster
, ApplicationId
and fileName.
For example if fileName is given as *.std*
, pattern will look like
file:/path/to/project/target/yarn--1502101888/*logDir*/application_1382082435804_0001/**/*.std*
yarnCluster
- the yarn clusterapplicationId
- the application idfileName
- the part of a file nameResource
sjava.io.IOException
- Signals that an I/O exception has occurred.public static java.util.List<org.springframework.core.io.Resource> queryContainerLogs(YarnCluster yarnCluster, org.apache.hadoop.yarn.api.records.ApplicationId applicationId) throws java.io.IOException
fileName
will be *
.yarnCluster
- the yarn clusterapplicationId
- the application idResource
sjava.io.IOException
- Signals that an I/O exception has occurred.queryContainerLogs(YarnCluster, ApplicationId, String)
public static java.lang.String getFileContent(java.io.File file) throws java.lang.Exception
NULL
if file doesn't exist and empty String if file exists but is empty.file
- the filejava.lang.Exception
- the exception if error occurred