YARN-5223. Container line in yarn logs output for a live application should include the hostname for the container. Contributed by Xuan Gong.

(cherry picked from commit 25064fb2fb)
This commit is contained in:
Varun Vasudev 2016-06-15 12:42:44 +05:30
parent 5bd39d2f3c
commit 75235149af
3 changed files with 7 additions and 3 deletions

View File

@ -393,7 +393,8 @@ public class LogsCLI extends Configured implements Tool {
newOptions.setLogTypes(matchedFiles);
Client webServiceClient = Client.create();
String containerString = "\n\nContainer: " + containerIdStr;
String containerString = "\n\nContainer: " + containerIdStr + " on "
+ nodeId;
out.println(containerString);
out.println(StringUtils.repeat("=", containerString.length()));

View File

@ -463,6 +463,8 @@ public class TestLogsCLI {
"Hello container_0_0001_01_000003 in syslog!"));
assertTrue(sysOutStream.toString().contains(
"Hello container_0_0001_01_000003 in stdout!"));
assertTrue(sysOutStream.toString().contains(
containerId3 + " on " + LogAggregationUtils.getNodeString(nodeId)));
sysOutStream.reset();
fs.delete(new Path(remoteLogRootDir), true);

View File

@ -153,7 +153,8 @@ public class LogCLIHelpers implements Configurable {
AggregatedLogFormat.LogReader reader = null;
PrintStream out = createPrintStream(localDir, fileName, containerId);
try {
String containerString = "\n\nContainer: " + containerId;
String containerString = "\n\nContainer: " + containerId + " on "
+ thisNodeFile.getPath().getName();
out.println(containerString);
out.println(StringUtils.repeat("=", containerString.length()));
reader =
@ -220,7 +221,7 @@ public class LogCLIHelpers implements Configurable {
thisNodeFile.getPath());
out = createPrintStream(localDir, thisNodeFile.getPath().getName(),
containerId);
out.println(containerId);
out.println(containerId + " on " + thisNodeFile.getPath().getName());
out.println(StringUtils.repeat("=", containerId.length()));
if (logType == null || logType.isEmpty()) {
if (dumpAContainerLogs(containerId, reader, out,