|
|
|
@ -89,8 +89,10 @@ import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileCo
|
|
|
|
|
import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerContext;
|
|
|
|
|
import org.apache.hadoop.yarn.logaggregation.filecontroller.LogAggregationFileControllerFactory;
|
|
|
|
|
import org.apache.hadoop.yarn.logaggregation.filecontroller.ifile.LogAggregationIndexedFileController;
|
|
|
|
|
import org.apache.hadoop.yarn.webapp.util.WebServiceClient;
|
|
|
|
|
import org.codehaus.jettison.json.JSONArray;
|
|
|
|
|
import org.codehaus.jettison.json.JSONObject;
|
|
|
|
|
import org.junit.After;
|
|
|
|
|
import org.junit.Assert;
|
|
|
|
|
import org.junit.Before;
|
|
|
|
|
import org.junit.Test;
|
|
|
|
@ -109,8 +111,10 @@ public class TestLogsCLI {
|
|
|
|
|
ByteArrayOutputStream sysErrStream;
|
|
|
|
|
private PrintStream sysErr;
|
|
|
|
|
|
|
|
|
|
private Configuration conf;
|
|
|
|
|
|
|
|
|
|
@Before
|
|
|
|
|
public void setUp() {
|
|
|
|
|
public void setUp() throws Exception {
|
|
|
|
|
sysOutStream = new ByteArrayOutputStream();
|
|
|
|
|
sysOut = new PrintStream(sysOutStream);
|
|
|
|
|
System.setOut(sysOut);
|
|
|
|
@ -118,11 +122,17 @@ public class TestLogsCLI {
|
|
|
|
|
sysErrStream = new ByteArrayOutputStream();
|
|
|
|
|
sysErr = new PrintStream(sysErrStream);
|
|
|
|
|
System.setErr(sysErr);
|
|
|
|
|
conf = new YarnConfiguration();
|
|
|
|
|
WebServiceClient.initialize(conf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@After
|
|
|
|
|
public void tearDown() {
|
|
|
|
|
WebServiceClient.destroy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test(timeout = 5000l)
|
|
|
|
|
public void testFailResultCodes() throws Exception {
|
|
|
|
|
Configuration conf = new YarnConfiguration();
|
|
|
|
|
conf.setClass("fs.file.impl", LocalFileSystem.class, FileSystem.class);
|
|
|
|
|
LogCLIHelpers cliHelper = new LogCLIHelpers();
|
|
|
|
|
cliHelper.setConf(conf);
|
|
|
|
@ -145,7 +155,6 @@ public class TestLogsCLI {
|
|
|
|
|
|
|
|
|
|
@Test(timeout = 10000l)
|
|
|
|
|
public void testInvalidOpts() throws Exception {
|
|
|
|
|
Configuration conf = new YarnConfiguration();
|
|
|
|
|
YarnClient mockYarnClient = createMockYarnClient(
|
|
|
|
|
YarnApplicationState.FINISHED,
|
|
|
|
|
UserGroupInformation.getCurrentUser().getShortUserName());
|
|
|
|
@ -160,7 +169,6 @@ public class TestLogsCLI {
|
|
|
|
|
|
|
|
|
|
@Test(timeout = 5000l)
|
|
|
|
|
public void testInvalidApplicationId() throws Exception {
|
|
|
|
|
Configuration conf = new YarnConfiguration();
|
|
|
|
|
YarnClient mockYarnClient = createMockYarnClient(
|
|
|
|
|
YarnApplicationState.FINISHED,
|
|
|
|
|
UserGroupInformation.getCurrentUser().getShortUserName());
|
|
|
|
@ -174,7 +182,6 @@ public class TestLogsCLI {
|
|
|
|
|
|
|
|
|
|
@Test(timeout = 5000L)
|
|
|
|
|
public void testInvalidAMContainerId() throws Exception {
|
|
|
|
|
Configuration conf = new YarnConfiguration();
|
|
|
|
|
conf.setBoolean(YarnConfiguration.APPLICATION_HISTORY_ENABLED, true);
|
|
|
|
|
YarnClient mockYarnClient =
|
|
|
|
|
createMockYarnClient(YarnApplicationState.FINISHED,
|
|
|
|
@ -196,7 +203,6 @@ public class TestLogsCLI {
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testAMContainerInfoFetchFromTimelineReader() throws Exception {
|
|
|
|
|
Configuration conf = new YarnConfiguration();
|
|
|
|
|
conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
|
|
|
|
|
conf.set(YarnConfiguration.TIMELINE_SERVICE_VERSIONS, "2.0f");
|
|
|
|
|
YarnClient mockYarnClient =
|
|
|
|
@ -232,7 +238,6 @@ public class TestLogsCLI {
|
|
|
|
|
|
|
|
|
|
@Test(timeout = 5000l)
|
|
|
|
|
public void testUnknownApplicationId() throws Exception {
|
|
|
|
|
Configuration conf = new YarnConfiguration();
|
|
|
|
|
YarnClient mockYarnClient = createMockYarnClientUnknownApp();
|
|
|
|
|
LogsCLI cli = new LogsCLIForTest(mockYarnClient);
|
|
|
|
|
cli.setConf(conf);
|
|
|
|
@ -248,7 +253,6 @@ public class TestLogsCLI {
|
|
|
|
|
|
|
|
|
|
@Test (timeout = 10000)
|
|
|
|
|
public void testHelpMessage() throws Exception {
|
|
|
|
|
Configuration conf = new YarnConfiguration();
|
|
|
|
|
YarnClient mockYarnClient = createMockYarnClient(
|
|
|
|
|
YarnApplicationState.FINISHED,
|
|
|
|
|
UserGroupInformation.getCurrentUser().getShortUserName());
|
|
|
|
@ -372,13 +376,12 @@ public class TestLogsCLI {
|
|
|
|
|
@Test (timeout = 15000)
|
|
|
|
|
public void testFetchFinishedApplictionLogs() throws Exception {
|
|
|
|
|
String remoteLogRootDir = "target/logs/";
|
|
|
|
|
Configuration configuration = new YarnConfiguration();
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
configuration
|
|
|
|
|
conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
conf
|
|
|
|
|
.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir);
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
configuration.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
FileSystem fs = FileSystem.get(configuration);
|
|
|
|
|
conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
FileSystem fs = FileSystem.get(conf);
|
|
|
|
|
|
|
|
|
|
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
|
|
|
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
|
|
|
@ -431,15 +434,15 @@ public class TestLogsCLI {
|
|
|
|
|
// the first two logs is empty. When we try to read first two logs,
|
|
|
|
|
// we will meet EOF exception, but it will not impact other logs.
|
|
|
|
|
// Other logs should be read successfully.
|
|
|
|
|
uploadEmptyContainerLogIntoRemoteDir(ugi, configuration, rootLogDirs, nodeId,
|
|
|
|
|
uploadEmptyContainerLogIntoRemoteDir(ugi, conf, rootLogDirs, nodeId,
|
|
|
|
|
containerId0, path, fs);
|
|
|
|
|
uploadEmptyContainerLogIntoRemoteDir(ugi, configuration, rootLogDirs, nodeId,
|
|
|
|
|
uploadEmptyContainerLogIntoRemoteDir(ugi, conf, rootLogDirs, nodeId,
|
|
|
|
|
containerId1, path, fs);
|
|
|
|
|
uploadContainerLogIntoRemoteDir(ugi, configuration, rootLogDirs, nodeId,
|
|
|
|
|
uploadContainerLogIntoRemoteDir(ugi, conf, rootLogDirs, nodeId,
|
|
|
|
|
containerId1, path, fs);
|
|
|
|
|
uploadContainerLogIntoRemoteDir(ugi, configuration, rootLogDirs, nodeId,
|
|
|
|
|
uploadContainerLogIntoRemoteDir(ugi, conf, rootLogDirs, nodeId,
|
|
|
|
|
containerId2, path, fs);
|
|
|
|
|
uploadContainerLogIntoRemoteDir(ugi, configuration, rootLogDirs, nodeId,
|
|
|
|
|
uploadContainerLogIntoRemoteDir(ugi, conf, rootLogDirs, nodeId,
|
|
|
|
|
containerId3, path, fs);
|
|
|
|
|
|
|
|
|
|
YarnClient mockYarnClient =
|
|
|
|
@ -455,7 +458,7 @@ public class TestLogsCLI {
|
|
|
|
|
return mockReport;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
cli.setConf(configuration);
|
|
|
|
|
cli.setConf(conf);
|
|
|
|
|
|
|
|
|
|
int exitCode = cli.run(new String[] { "-applicationId", appId.toString() });
|
|
|
|
|
LOG.info(sysOutStream.toString());
|
|
|
|
@ -681,7 +684,7 @@ public class TestLogsCLI {
|
|
|
|
|
YarnClient mockYarnClientWithException =
|
|
|
|
|
createMockYarnClientWithException();
|
|
|
|
|
cli = new LogsCLIForTest(mockYarnClientWithException);
|
|
|
|
|
cli.setConf(configuration);
|
|
|
|
|
cli.setConf(conf);
|
|
|
|
|
|
|
|
|
|
exitCode =
|
|
|
|
|
cli.run(new String[] { "-applicationId", appId.toString(),
|
|
|
|
@ -804,8 +807,7 @@ public class TestLogsCLI {
|
|
|
|
|
any(ContainerId.class));
|
|
|
|
|
|
|
|
|
|
// create local logs
|
|
|
|
|
Configuration configuration = new YarnConfiguration();
|
|
|
|
|
FileSystem fs = FileSystem.get(configuration);
|
|
|
|
|
FileSystem fs = FileSystem.get(conf);
|
|
|
|
|
String rootLogDir = "target/LocalLogs";
|
|
|
|
|
Path rootLogDirPath = new Path(rootLogDir);
|
|
|
|
|
if (fs.exists(rootLogDirPath)) {
|
|
|
|
@ -964,13 +966,12 @@ public class TestLogsCLI {
|
|
|
|
|
UserGroupInformation testUgi = UserGroupInformation
|
|
|
|
|
.createRemoteUser(testUser);
|
|
|
|
|
|
|
|
|
|
Configuration configuration = new YarnConfiguration();
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
configuration
|
|
|
|
|
conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
conf
|
|
|
|
|
.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir);
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
configuration.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
FileSystem fs = FileSystem.get(configuration);
|
|
|
|
|
conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
FileSystem fs = FileSystem.get(conf);
|
|
|
|
|
|
|
|
|
|
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
|
|
|
|
ApplicationAttemptId appAttemptId =
|
|
|
|
@ -1010,13 +1011,13 @@ public class TestLogsCLI {
|
|
|
|
|
assertTrue(fs.mkdirs(path));
|
|
|
|
|
|
|
|
|
|
// upload container logs for app into remote dir
|
|
|
|
|
uploadContainerLogIntoRemoteDir(testUgi, configuration, rootLogDirs,
|
|
|
|
|
uploadContainerLogIntoRemoteDir(testUgi, conf, rootLogDirs,
|
|
|
|
|
nodeId, containerId, path, fs);
|
|
|
|
|
|
|
|
|
|
YarnClient mockYarnClient = createMockYarnClient(
|
|
|
|
|
YarnApplicationState.FINISHED, testUgi.getShortUserName());
|
|
|
|
|
LogsCLI cli = new LogsCLIForTest(mockYarnClient);
|
|
|
|
|
cli.setConf(configuration);
|
|
|
|
|
cli.setConf(conf);
|
|
|
|
|
|
|
|
|
|
// Verify that we can get the application logs by specifying
|
|
|
|
|
// a correct appOwner
|
|
|
|
@ -1043,7 +1044,7 @@ public class TestLogsCLI {
|
|
|
|
|
// and can get app logs successfully.
|
|
|
|
|
YarnClient mockYarnClient2 = createMockYarnClientUnknownApp();
|
|
|
|
|
cli = new LogsCLIForTest(mockYarnClient2);
|
|
|
|
|
cli.setConf(configuration);
|
|
|
|
|
cli.setConf(conf);
|
|
|
|
|
exitCode = cli.run(new String[] {
|
|
|
|
|
"-applicationId", appId.toString()});
|
|
|
|
|
assertTrue(exitCode == 0);
|
|
|
|
@ -1057,7 +1058,7 @@ public class TestLogsCLI {
|
|
|
|
|
fs.delete(path, true);
|
|
|
|
|
}
|
|
|
|
|
assertTrue(fs.mkdirs(path));
|
|
|
|
|
uploadContainerLogIntoRemoteDir(testUgi, configuration, rootLogDirs,
|
|
|
|
|
uploadContainerLogIntoRemoteDir(testUgi, conf, rootLogDirs,
|
|
|
|
|
nodeId, containerId, path, fs);
|
|
|
|
|
|
|
|
|
|
exitCode = cli.run(new String[] {
|
|
|
|
@ -1112,14 +1113,13 @@ public class TestLogsCLI {
|
|
|
|
|
public void testLogsCLIWithInvalidArgs() throws Exception {
|
|
|
|
|
String localDir = "target/SaveLogs";
|
|
|
|
|
Path localPath = new Path(localDir);
|
|
|
|
|
Configuration configuration = new YarnConfiguration();
|
|
|
|
|
FileSystem fs = FileSystem.get(configuration);
|
|
|
|
|
FileSystem fs = FileSystem.get(conf);
|
|
|
|
|
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
|
|
|
|
YarnClient mockYarnClient =
|
|
|
|
|
createMockYarnClient(YarnApplicationState.FINISHED,
|
|
|
|
|
UserGroupInformation.getCurrentUser().getShortUserName());
|
|
|
|
|
LogsCLI cli = new LogsCLIForTest(mockYarnClient);
|
|
|
|
|
cli.setConf(configuration);
|
|
|
|
|
cli.setConf(conf);
|
|
|
|
|
|
|
|
|
|
// Specify an invalid applicationId
|
|
|
|
|
int exitCode = cli.run(new String[] {"-applicationId",
|
|
|
|
@ -1180,7 +1180,6 @@ public class TestLogsCLI {
|
|
|
|
|
String remoteLogRootDir = "target/logs/";
|
|
|
|
|
String jobUser = "user1";
|
|
|
|
|
String loggedUser = "user2";
|
|
|
|
|
Configuration conf = new YarnConfiguration();
|
|
|
|
|
conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir);
|
|
|
|
|
conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
@ -1226,7 +1225,6 @@ public class TestLogsCLI {
|
|
|
|
|
String remoteLogRootDir1 = "target/logs1/";
|
|
|
|
|
String jobUser = "user1";
|
|
|
|
|
String loggedUser = "user2";
|
|
|
|
|
Configuration conf = new YarnConfiguration();
|
|
|
|
|
conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir);
|
|
|
|
|
String controllerName = "indexed";
|
|
|
|
@ -1261,14 +1259,13 @@ public class TestLogsCLI {
|
|
|
|
|
String localDir = "target/SaveLogs";
|
|
|
|
|
Path localPath = new Path(localDir);
|
|
|
|
|
|
|
|
|
|
Configuration configuration = new YarnConfiguration();
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
configuration
|
|
|
|
|
conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
conf
|
|
|
|
|
.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir);
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
configuration.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
|
|
|
|
|
FileSystem fs = FileSystem.get(configuration);
|
|
|
|
|
FileSystem fs = FileSystem.get(conf);
|
|
|
|
|
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
|
|
|
|
ApplicationAttemptId appAttemptId =
|
|
|
|
|
ApplicationAttemptId.newInstance(appId, 1);
|
|
|
|
@ -1287,14 +1284,14 @@ public class TestLogsCLI {
|
|
|
|
|
nodeIds.add(nodeId2);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
createContainerLogs(configuration, remoteLogRootDir, rootLogDir, fs,
|
|
|
|
|
createContainerLogs(conf, remoteLogRootDir, rootLogDir, fs,
|
|
|
|
|
appId, containerIds, nodeIds);
|
|
|
|
|
|
|
|
|
|
YarnClient mockYarnClient =
|
|
|
|
|
createMockYarnClient(YarnApplicationState.FINISHED,
|
|
|
|
|
UserGroupInformation.getCurrentUser().getShortUserName());
|
|
|
|
|
LogsCLI cli = new LogsCLIForTest(mockYarnClient);
|
|
|
|
|
cli.setConf(configuration);
|
|
|
|
|
cli.setConf(conf);
|
|
|
|
|
int exitCode = cli.run(new String[] {"-applicationId",
|
|
|
|
|
appId.toString(),
|
|
|
|
|
"-out" , localPath.toString()});
|
|
|
|
@ -1352,13 +1349,12 @@ public class TestLogsCLI {
|
|
|
|
|
@Test (timeout = 15000)
|
|
|
|
|
public void testPrintContainerLogMetadata() throws Exception {
|
|
|
|
|
String remoteLogRootDir = "target/logs/";
|
|
|
|
|
Configuration configuration = new YarnConfiguration();
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
configuration
|
|
|
|
|
conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
conf
|
|
|
|
|
.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir);
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
configuration.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
FileSystem fs = FileSystem.get(configuration);
|
|
|
|
|
conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
FileSystem fs = FileSystem.get(conf);
|
|
|
|
|
String rootLogDir = "target/LocalLogs";
|
|
|
|
|
|
|
|
|
|
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
|
|
|
@ -1377,14 +1373,14 @@ public class TestLogsCLI {
|
|
|
|
|
nodeIds.add(nodeId);
|
|
|
|
|
nodeIds.add(nodeId);
|
|
|
|
|
|
|
|
|
|
createContainerLogs(configuration, remoteLogRootDir, rootLogDir, fs,
|
|
|
|
|
createContainerLogs(conf, remoteLogRootDir, rootLogDir, fs,
|
|
|
|
|
appId, containerIds, nodeIds);
|
|
|
|
|
|
|
|
|
|
YarnClient mockYarnClient =
|
|
|
|
|
createMockYarnClient(YarnApplicationState.FINISHED,
|
|
|
|
|
UserGroupInformation.getCurrentUser().getShortUserName());
|
|
|
|
|
LogsCLI cli = new LogsCLIForTest(mockYarnClient);
|
|
|
|
|
cli.setConf(configuration);
|
|
|
|
|
cli.setConf(conf);
|
|
|
|
|
|
|
|
|
|
cli.run(new String[] {"-applicationId", appId.toString(),
|
|
|
|
|
"-show_container_log_info"});
|
|
|
|
@ -1457,12 +1453,11 @@ public class TestLogsCLI {
|
|
|
|
|
@Test (timeout = 15000)
|
|
|
|
|
public void testListNodeInfo() throws Exception {
|
|
|
|
|
String remoteLogRootDir = "target/logs/";
|
|
|
|
|
Configuration configuration = new YarnConfiguration();
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
configuration
|
|
|
|
|
conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
conf
|
|
|
|
|
.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir);
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
configuration.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
|
|
|
|
|
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
|
|
|
|
ApplicationAttemptId appAttemptId =
|
|
|
|
@ -1482,16 +1477,16 @@ public class TestLogsCLI {
|
|
|
|
|
nodeIds.add(nodeId2);
|
|
|
|
|
|
|
|
|
|
String rootLogDir = "target/LocalLogs";
|
|
|
|
|
FileSystem fs = FileSystem.get(configuration);
|
|
|
|
|
FileSystem fs = FileSystem.get(conf);
|
|
|
|
|
|
|
|
|
|
createContainerLogs(configuration, remoteLogRootDir, rootLogDir, fs,
|
|
|
|
|
createContainerLogs(conf, remoteLogRootDir, rootLogDir, fs,
|
|
|
|
|
appId, containerIds, nodeIds);
|
|
|
|
|
|
|
|
|
|
YarnClient mockYarnClient =
|
|
|
|
|
createMockYarnClient(YarnApplicationState.FINISHED,
|
|
|
|
|
UserGroupInformation.getCurrentUser().getShortUserName());
|
|
|
|
|
LogsCLI cli = new LogsCLIForTest(mockYarnClient);
|
|
|
|
|
cli.setConf(configuration);
|
|
|
|
|
cli.setConf(conf);
|
|
|
|
|
|
|
|
|
|
cli.run(new String[] { "-applicationId", appId.toString(),
|
|
|
|
|
"-list_nodes" });
|
|
|
|
@ -1508,13 +1503,12 @@ public class TestLogsCLI {
|
|
|
|
|
@Test (timeout = 15000)
|
|
|
|
|
public void testFetchApplictionLogsHar() throws Exception {
|
|
|
|
|
String remoteLogRootDir = "target/logs/";
|
|
|
|
|
Configuration configuration = new YarnConfiguration();
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
configuration
|
|
|
|
|
conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);
|
|
|
|
|
conf
|
|
|
|
|
.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir);
|
|
|
|
|
configuration.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
configuration.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
FileSystem fs = FileSystem.get(configuration);
|
|
|
|
|
conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
|
|
|
|
|
conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
|
|
|
|
|
FileSystem fs = FileSystem.get(conf);
|
|
|
|
|
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
|
|
|
URL harUrl = ClassLoader.getSystemClassLoader()
|
|
|
|
|
.getResource("application_1440536969523_0001.har");
|
|
|
|
@ -1534,7 +1528,7 @@ public class TestLogsCLI {
|
|
|
|
|
createMockYarnClient(YarnApplicationState.FINISHED,
|
|
|
|
|
ugi.getShortUserName());
|
|
|
|
|
LogsCLI cli = new LogsCLIForTest(mockYarnClient);
|
|
|
|
|
cli.setConf(configuration);
|
|
|
|
|
cli.setConf(conf);
|
|
|
|
|
int exitCode = cli.run(new String[]{"-applicationId",
|
|
|
|
|
"application_1440536969523_0001"});
|
|
|
|
|
assertTrue(exitCode == 0);
|
|
|
|
|