diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java index 1085c14..9b0268f 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/cli/TestLogsCLI.java @@ -284,7 +284,7 @@ public void testHelpMessage() throws Exception { @Test (timeout = 15000) public void testFetchFinishedApplictionLogs() throws Exception { String remoteLogRootDir = "target/logs/"; - Configuration configuration = new Configuration(); + Configuration configuration = new YarnConfiguration(); configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true); configuration .set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir); @@ -645,7 +645,7 @@ public void testGetRunningContainerLogs() throws Exception { any(ContainerId.class)); // create local logs - Configuration configuration = new Configuration(); + Configuration configuration = new YarnConfiguration(); FileSystem fs = FileSystem.get(configuration); String rootLogDir = "target/LocalLogs"; Path rootLogDirPath = new Path(rootLogDir); @@ -790,7 +790,7 @@ public void testFetchApplictionLogsAsAnotherUser() throws Exception { UserGroupInformation testUgi = UserGroupInformation .createRemoteUser(testUser); - Configuration configuration = new Configuration(); + Configuration configuration = new YarnConfiguration(); configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true); configuration .set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir); @@ -921,7 +921,7 @@ public void testFetchApplictionLogsAsAnotherUser() throws Exception { public void testLogsCLIWithInvalidArgs() throws Exception { String localDir = "target/SaveLogs"; Path localPath = new Path(localDir); - Configuration configuration = new Configuration(); + Configuration configuration = new YarnConfiguration(); FileSystem fs = FileSystem.get(configuration); ApplicationId appId = ApplicationId.newInstance(0, 1); YarnClient mockYarnClient = @@ -992,7 +992,7 @@ public void testSaveContainerLogsLocally() throws Exception { String localDir = "target/SaveLogs"; Path localPath = new Path(localDir); - Configuration configuration = new Configuration(); + Configuration configuration = new YarnConfiguration(); configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true); configuration .set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir); @@ -1083,7 +1083,7 @@ private String readContainerContent(Path containerPath, @Test (timeout = 15000) public void testPrintContainerLogMetadata() throws Exception { String remoteLogRootDir = "target/logs/"; - Configuration configuration = new Configuration(); + Configuration configuration = new YarnConfiguration(); configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true); configuration .set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir); @@ -1188,7 +1188,7 @@ public void testPrintContainerLogMetadata() throws Exception { @Test (timeout = 15000) public void testListNodeInfo() throws Exception { String remoteLogRootDir = "target/logs/"; - Configuration configuration = new Configuration(); + Configuration configuration = new YarnConfiguration(); configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true); configuration .set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir); @@ -1239,7 +1239,7 @@ public void testListNodeInfo() throws Exception { @Test (timeout = 15000) public void testFetchApplictionLogsHar() throws Exception { String remoteLogRootDir = "target/logs/"; - Configuration configuration = new Configuration(); + Configuration configuration = new YarnConfiguration(); configuration.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true); configuration .set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogRootDir); diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java index 03acb33..a77dc56 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogCLIHelpers.java @@ -128,8 +128,17 @@ public int dumpAContainerLogsForLogType(ContainerLogsRequest options) @VisibleForTesting public int dumpAContainerLogsForLogType(ContainerLogsRequest options, boolean outputFailure) throws IOException { - boolean foundAnyLogs = this.getFileController(options.getAppId(), - options.getAppOwner()).readAggregatedLogs(options, null); + LogAggregationFileController fc = null; + try { + fc = this.getFileController( + options.getAppId(), options.getAppOwner()); + } catch (IOException ex) { + System.err.println(ex); + } + boolean foundAnyLogs = false; + if (fc != null) { + foundAnyLogs = fc.readAggregatedLogs(options, null); + } if (!foundAnyLogs) { if (outputFailure) { containerLogNotFound(options.getContainerId()); @@ -142,9 +151,17 @@ public int dumpAContainerLogsForLogType(ContainerLogsRequest options, @Private public int dumpAContainerLogsForLogTypeWithoutNodeId( ContainerLogsRequest options) throws IOException { - boolean foundAnyLogs = getFileController(options.getAppId(), - options.getAppOwner()).readAggregatedLogs( - options, null); + LogAggregationFileController fc = null; + try { + fc = this.getFileController( + options.getAppId(), options.getAppOwner()); + } catch (IOException ex) { + System.err.println(ex); + } + boolean foundAnyLogs = false; + if (fc != null) { + foundAnyLogs = fc.readAggregatedLogs(options, null); + } if (!foundAnyLogs) { containerLogNotFound(options.getContainerId()); return -1; @@ -155,9 +172,19 @@ public int dumpAContainerLogsForLogTypeWithoutNodeId( @Private public int dumpAllContainersLogs(ContainerLogsRequest options) throws IOException { - boolean foundAnyLogs = getFileController(options.getAppId(), - options.getAppOwner()).readAggregatedLogs( - options, null); + LogAggregationFileController fc = null; + try { + System.out.println("I am here"); + fc = this.getFileController( + options.getAppId(), options.getAppOwner()); + } catch (IOException ex) { + System.out.println("I am here123"); + System.err.println(ex); + } + boolean foundAnyLogs = false; + if (fc != null) { + foundAnyLogs = fc.readAggregatedLogs(options, null); + } if (!foundAnyLogs) { emptyLogDir(LogAggregationUtils.getRemoteAppLogDir( conf, options.getAppId(), options.getAppOwner()) diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/tfile/LogAggregationTFileController.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/tfile/LogAggregationTFileController.java index d2038e2..aaed538 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/tfile/LogAggregationTFileController.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/tfile/LogAggregationTFileController.java @@ -172,7 +172,6 @@ public boolean readAggregatedLogs(ContainerLogsRequest logRequest, byte[] buf = new byte[65535]; while (nodeFiles != null && nodeFiles.hasNext()) { final FileStatus thisNodeFile = nodeFiles.next(); - LOG.error(thisNodeFile.getPath().toString()); String nodeName = thisNodeFile.getPath().getName(); if (nodeName.equals(appId + ".har")) { Path p = new Path("har:///"