YARN-6174. Log files pattern should be same for both running and finished container. Contributed by Xuan Gong.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ce2d5bfa Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ce2d5bfa Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ce2d5bfa Branch: refs/heads/HADOOP-13345 Commit: ce2d5bfa5f84e7e563980796549b56ef1e4bbf1e Parents: 859bd15 Author: Junping Du <junping...@apache.org> Authored: Wed Feb 15 09:05:14 2017 -0800 Committer: Junping Du <junping...@apache.org> Committed: Wed Feb 15 09:05:14 2017 -0800 ---------------------------------------------------------------------- .../ContainerLogAggregationType.java | 31 ++++++++++++++++++++ .../yarn/logaggregation/LogToolUtils.java | 11 +++---- .../webapp/AHSWebServices.java | 13 ++++---- .../webapp/TestAHSWebServices.java | 26 +++++++++------- .../server/webapp/dao/ContainerLogsInfo.java | 8 ++--- .../nodemanager/webapp/NMWebServices.java | 11 +++---- .../webapp/dao/NMContainerLogsInfo.java | 4 +-- .../nodemanager/webapp/TestNMWebServices.java | 19 ++++++------ 8 files changed, 82 insertions(+), 41 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce2d5bfa/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/ContainerLogAggregationType.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/ContainerLogAggregationType.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/ContainerLogAggregationType.java new file mode 100644 index 0000000..664448b --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/ContainerLogAggregationType.java @@ -0,0 +1,31 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.logaggregation; + +/** + * Enumeration of various aggregation type of a container log. + */ +public enum ContainerLogAggregationType { + + /** The log is from NodeManager local log directory. */ + LOCAL, + + /** The log is from Remote FileSystem application log directory. */ + AGGREGATED +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce2d5bfa/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogToolUtils.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogToolUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogToolUtils.java index d83a8ae..ae2517a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogToolUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/LogToolUtils.java @@ -141,7 +141,7 @@ public final class LogToolUtils { public static void outputContainerLog(String containerId, String nodeId, String fileName, long fileLength, long outputSize, String lastModifiedTime, InputStream fis, OutputStream os, - byte[] buf, ContainerLogType logType) throws IOException { + byte[] buf, ContainerLogAggregationType logType) throws IOException { long toSkip = 0; long totalBytesToRead = fileLength; long skipAfterRead = 0; @@ -171,9 +171,9 @@ public final class LogToolUtils { LogToolUtils.CONTAINER_ON_NODE_PATTERN, containerId, nodeId); sb.append(containerStr + "\n"); - sb.append("LogType: " + logType + "\n"); + sb.append("LogAggregationType: " + logType + "\n"); sb.append(StringUtils.repeat("=", containerStr.length()) + "\n"); - sb.append("FileName:" + fileName + "\n"); + sb.append("LogType:" + fileName + "\n"); sb.append("LogLastModifiedTime:" + lastModifiedTime + "\n"); sb.append("LogLength:" + Long.toString(fileLength) + "\n"); sb.append("LogContents:\n"); @@ -240,9 +240,10 @@ public final class LogToolUtils { LogToolUtils.outputContainerLog(containerId, nodeId, fileType, fileLength, outputSize, Times.format(thisNodeFile.getModificationTime()), - valueStream, os, buf, ContainerLogType.AGGREGATED); + valueStream, os, buf, + ContainerLogAggregationType.AGGREGATED); StringBuilder sb = new StringBuilder(); - String endOfFile = "End of LogFile:" + fileType; + String endOfFile = "End of LogType:" + fileType; sb.append("\n" + endOfFile + "\n"); sb.append(StringUtils.repeat("*", endOfFile.length() + 50) + "\n\n"); http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce2d5bfa/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java index 33307a9..c296aaa 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java @@ -55,7 +55,7 @@ import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.api.ApplicationBaseProtocol; import org.apache.hadoop.yarn.api.records.timeline.TimelineAbout; import org.apache.hadoop.yarn.logaggregation.ContainerLogMeta; -import org.apache.hadoop.yarn.logaggregation.ContainerLogType; +import org.apache.hadoop.yarn.logaggregation.ContainerLogAggregationType; import org.apache.hadoop.yarn.logaggregation.LogToolUtils; import org.apache.hadoop.yarn.server.webapp.WebServices; import org.apache.hadoop.yarn.server.webapp.YarnWebServiceParams; @@ -510,13 +510,14 @@ public class AHSWebServices extends WebServices { boolean findLogs = LogToolUtils.outputAggregatedContainerLog(conf, appId, appOwner, containerIdStr, nodeId, logFile, bytes, os, buf); if (!findLogs) { - throw new IOException("Can not find logs for container:" - + containerIdStr); + os.write(("Can not find logs for container:" + + containerIdStr).getBytes(Charset.forName("UTF-8"))); } else { if (printEmptyLocalContainerLog) { StringBuilder sb = new StringBuilder(); sb.append(containerIdStr + "\n"); - sb.append("LogType: " + ContainerLogType.LOCAL + "\n"); + sb.append("LogAggregationType: " + + ContainerLogAggregationType.LOCAL + "\n"); sb.append("LogContents:\n"); sb.append(getNoRedirectWarning() + "\n"); os.write(sb.toString().getBytes(Charset.forName("UTF-8"))); @@ -548,14 +549,14 @@ public class AHSWebServices extends WebServices { List<ContainerLogsInfo> containersLogsInfo = new ArrayList<>(); for (ContainerLogMeta meta : containerLogMeta) { ContainerLogsInfo logInfo = new ContainerLogsInfo(meta, - ContainerLogType.AGGREGATED); + ContainerLogAggregationType.AGGREGATED); containersLogsInfo.add(logInfo); } if (emptyLocalContainerLogMeta) { ContainerLogMeta emptyMeta = new ContainerLogMeta( containerIdStr, "N/A"); ContainerLogsInfo empty = new ContainerLogsInfo(emptyMeta, - ContainerLogType.LOCAL); + ContainerLogAggregationType.LOCAL); containersLogsInfo.add(empty); } GenericEntity<List<ContainerLogsInfo>> meta = new GenericEntity<List< http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce2d5bfa/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java index 85bf1b4..c2cfb3b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/TestAHSWebServices.java @@ -52,7 +52,7 @@ import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState; import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.conf.YarnConfiguration; -import org.apache.hadoop.yarn.logaggregation.ContainerLogType; +import org.apache.hadoop.yarn.logaggregation.ContainerLogAggregationType; import org.apache.hadoop.yarn.logaggregation.PerContainerLogFileInfo; import org.apache.hadoop.yarn.logaggregation.TestContainerLogsUtils; import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryClientService; @@ -599,8 +599,8 @@ public class TestAHSWebServices extends JerseyTestBase { assertTrue(responseText.contains("Hello." + containerId1ForApp100)); int fullTextSize = responseText.getBytes().length; String tailEndSeparator = StringUtils.repeat("*", - "End of LogFile:syslog".length() + 50) + "\n\n"; - int tailTextSize = "\nEnd of LogFile:syslog\n".getBytes().length + "End of LogType:syslog".length() + 50) + "\n\n"; + int tailTextSize = "\nEnd of LogType:syslog\n".getBytes().length + tailEndSeparator.getBytes().length; String logMessage = "Hello." + containerId1ForApp100; @@ -752,7 +752,8 @@ public class TestAHSWebServices extends JerseyTestBase { assertTrue(responseText.contains(content)); // Also test whether we output the empty local container log, and give // the warning message. - assertTrue(responseText.contains("LogType: " + ContainerLogType.LOCAL)); + assertTrue(responseText.contains("LogAggregationType: " + + ContainerLogAggregationType.LOCAL)); assertTrue(responseText.contains(AHSWebServices.getNoRedirectWarning())); // If we can not container information from ATS, and we specify the NM id, @@ -767,7 +768,8 @@ public class TestAHSWebServices extends JerseyTestBase { .get(ClientResponse.class); responseText = response.getEntity(String.class); assertTrue(responseText.contains(content)); - assertTrue(responseText.contains("LogType: " + ContainerLogType.LOCAL)); + assertTrue(responseText.contains("LogAggregationType: " + + ContainerLogAggregationType.LOCAL)); assertTrue(responseText.contains(AHSWebServices.getNoRedirectWarning())); } @@ -830,7 +832,8 @@ public class TestAHSWebServices extends JerseyTestBase { List<ContainerLogsInfo>>(){}); assertTrue(responseText.size() == 2); for (ContainerLogsInfo logInfo : responseText) { - if(logInfo.getLogType().equals(ContainerLogType.AGGREGATED.toString())) { + if(logInfo.getLogType().equals( + ContainerLogAggregationType.AGGREGATED.toString())) { List<PerContainerLogFileInfo> logMeta = logInfo .getContainerLogsInfo(); assertTrue(logMeta.size() == 1); @@ -838,7 +841,8 @@ public class TestAHSWebServices extends JerseyTestBase { assertEquals(logMeta.get(0).getFileSize(), String.valueOf( content.length())); } else { - assertEquals(logInfo.getLogType(), ContainerLogType.LOCAL.toString()); + assertEquals(logInfo.getLogType(), + ContainerLogAggregationType.LOCAL.toString()); } } @@ -856,7 +860,8 @@ public class TestAHSWebServices extends JerseyTestBase { List<ContainerLogsInfo>>(){}); assertTrue(responseText.size() == 2); for (ContainerLogsInfo logInfo : responseText) { - if(logInfo.getLogType().equals(ContainerLogType.AGGREGATED.toString())) { + if(logInfo.getLogType().equals( + ContainerLogAggregationType.AGGREGATED.toString())) { List<PerContainerLogFileInfo> logMeta = logInfo .getContainerLogsInfo(); assertTrue(logMeta.size() == 1); @@ -864,7 +869,8 @@ public class TestAHSWebServices extends JerseyTestBase { assertEquals(logMeta.get(0).getFileSize(), String.valueOf( content.length())); } else { - assertEquals(logInfo.getLogType(), ContainerLogType.LOCAL.toString()); + assertEquals(logInfo.getLogType(), + ContainerLogAggregationType.LOCAL.toString()); } } } @@ -893,7 +899,7 @@ public class TestAHSWebServices extends JerseyTestBase { List<ContainerLogsInfo>>(){}); assertTrue(responseText.size() == 1); assertEquals(responseText.get(0).getLogType(), - ContainerLogType.AGGREGATED.toString()); + ContainerLogAggregationType.AGGREGATED.toString()); List<PerContainerLogFileInfo> logMeta = responseText.get(0) .getContainerLogsInfo(); assertTrue(logMeta.size() == 1); http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce2d5bfa/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/ContainerLogsInfo.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/ContainerLogsInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/ContainerLogsInfo.java index fd3c43b..bc3ab39 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/ContainerLogsInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/dao/ContainerLogsInfo.java @@ -26,7 +26,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.logaggregation.ContainerLogMeta; -import org.apache.hadoop.yarn.logaggregation.ContainerLogType; +import org.apache.hadoop.yarn.logaggregation.ContainerLogAggregationType; import org.apache.hadoop.yarn.logaggregation.PerContainerLogFileInfo; /** @@ -48,7 +48,7 @@ public class ContainerLogsInfo { @XmlElement(name = "containerLogInfo") protected List<PerContainerLogFileInfo> containerLogsInfo; - @XmlElement(name = "logType") + @XmlElement(name = "logAggregationType") protected String logType; @XmlElement(name = "containerId") @@ -60,8 +60,8 @@ public class ContainerLogsInfo { //JAXB needs this public ContainerLogsInfo() {} - public ContainerLogsInfo(ContainerLogMeta logMeta, ContainerLogType logType) - throws YarnException { + public ContainerLogsInfo(ContainerLogMeta logMeta, + ContainerLogAggregationType logType) throws YarnException { this.containerLogsInfo = new ArrayList<PerContainerLogFileInfo>( logMeta.getContainerLogMeta()); this.logType = logType.toString(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce2d5bfa/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/NMWebServices.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/NMWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/NMWebServices.java index 44b232d..4e72746 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/NMWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/NMWebServices.java @@ -55,7 +55,7 @@ import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.factories.RecordFactory; import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; import org.apache.hadoop.yarn.logaggregation.ContainerLogMeta; -import org.apache.hadoop.yarn.logaggregation.ContainerLogType; +import org.apache.hadoop.yarn.logaggregation.ContainerLogAggregationType; import org.apache.hadoop.yarn.logaggregation.LogToolUtils; import org.apache.hadoop.yarn.server.nodemanager.Context; import org.apache.hadoop.yarn.server.nodemanager.ResourceView; @@ -253,7 +253,7 @@ public class NMWebServices { List<ContainerLogsInfo> containersLogsInfo = new ArrayList<>(); containersLogsInfo.add(new NMContainerLogsInfo( this.nmContext, containerId, - hsr.getRemoteUser(), ContainerLogType.LOCAL)); + hsr.getRemoteUser(), ContainerLogAggregationType.LOCAL)); // check whether we have aggregated logs in RemoteFS. If exists, show the // the log meta for the aggregated logs as well. ApplicationId appId = containerId.getApplicationAttemptId() @@ -268,7 +268,7 @@ public class NMWebServices { if (!containerLogMeta.isEmpty()) { for (ContainerLogMeta logMeta : containerLogMeta) { containersLogsInfo.add(new ContainerLogsInfo(logMeta, - ContainerLogType.AGGREGATED)); + ContainerLogAggregationType.AGGREGATED)); } } } catch (IOException ex) { @@ -429,9 +429,10 @@ public class NMWebServices { byte[] buf = new byte[bufferSize]; LogToolUtils.outputContainerLog(containerId.toString(), nmContext.getNodeId().toString(), outputFileName, fileLength, - bytes, lastModifiedTime, fis, os, buf, ContainerLogType.LOCAL); + bytes, lastModifiedTime, fis, os, buf, + ContainerLogAggregationType.LOCAL); StringBuilder sb = new StringBuilder(); - String endOfFile = "End of LogFile:" + outputFileName; + String endOfFile = "End of LogType:" + outputFileName; sb.append(endOfFile + "."); if (isRunning) { sb.append("This log file belongs to a running container (" http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce2d5bfa/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/dao/NMContainerLogsInfo.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/dao/NMContainerLogsInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/dao/NMContainerLogsInfo.java index d2bc6f2..5415e04 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/dao/NMContainerLogsInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/dao/NMContainerLogsInfo.java @@ -26,7 +26,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.exceptions.YarnException; -import org.apache.hadoop.yarn.logaggregation.ContainerLogType; +import org.apache.hadoop.yarn.logaggregation.ContainerLogAggregationType; import org.apache.hadoop.yarn.logaggregation.PerContainerLogFileInfo; import org.apache.hadoop.yarn.server.nodemanager.Context; import org.apache.hadoop.yarn.server.nodemanager.webapp.ContainerLogsUtils; @@ -47,7 +47,7 @@ public class NMContainerLogsInfo extends ContainerLogsInfo { public NMContainerLogsInfo(final Context nmContext, final ContainerId containerId, String remoteUser, - ContainerLogType logType) throws YarnException { + ContainerLogAggregationType logType) throws YarnException { this.logType = logType.toString(); this.containerId = containerId.toString(); this.nodeId = nmContext.getNodeId().toString(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce2d5bfa/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/webapp/TestNMWebServices.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/webapp/TestNMWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/webapp/TestNMWebServices.java index e3773d9..d9fd289 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/webapp/TestNMWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/webapp/TestNMWebServices.java @@ -50,7 +50,7 @@ import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.event.AsyncDispatcher; -import org.apache.hadoop.yarn.logaggregation.ContainerLogType; +import org.apache.hadoop.yarn.logaggregation.ContainerLogAggregationType; import org.apache.hadoop.yarn.logaggregation.PerContainerLogFileInfo; import org.apache.hadoop.yarn.logaggregation.TestContainerLogsUtils; import org.apache.hadoop.yarn.server.nodemanager.Context; @@ -530,7 +530,7 @@ public class TestNMWebServices extends JerseyTestBase { List<ContainerLogsInfo>>(){}); assertTrue(responseList.size() == 1); assertEquals(responseList.get(0).getLogType(), - ContainerLogType.LOCAL.toString()); + ContainerLogAggregationType.LOCAL.toString()); List<PerContainerLogFileInfo> logMeta = responseList.get(0) .getContainerLogsInfo(); assertTrue(logMeta.size() == 1); @@ -557,12 +557,13 @@ public class TestNMWebServices extends JerseyTestBase { assertEquals(responseList.size(), 2); for (ContainerLogsInfo logInfo : responseList) { if(logInfo.getLogType().equals( - ContainerLogType.AGGREGATED.toString())) { + ContainerLogAggregationType.AGGREGATED.toString())) { List<PerContainerLogFileInfo> meta = logInfo.getContainerLogsInfo(); assertTrue(meta.size() == 1); assertEquals(meta.get(0).getFileName(), aggregatedLogFile); } else { - assertEquals(logInfo.getLogType(), ContainerLogType.LOCAL.toString()); + assertEquals(logInfo.getLogType(), + ContainerLogAggregationType.LOCAL.toString()); List<PerContainerLogFileInfo> meta = logInfo.getContainerLogsInfo(); assertTrue(meta.size() == 1); assertEquals(meta.get(0).getFileName(), filename); @@ -577,11 +578,11 @@ public class TestNMWebServices extends JerseyTestBase { response = r.path(filename) .accept(MediaType.TEXT_PLAIN).get(ClientResponse.class); responseText = response.getEntity(String.class); - assertTrue(responseText.contains("LogType: " - + ContainerLogType.AGGREGATED)); + assertTrue(responseText.contains("LogAggregationType: " + + ContainerLogAggregationType.AGGREGATED)); assertTrue(responseText.contains(aggregatedLogMessage)); - assertTrue(responseText.contains("LogType: " - + ContainerLogType.LOCAL)); + assertTrue(responseText.contains("LogAggregationType: " + + ContainerLogAggregationType.LOCAL)); assertTrue(responseText.contains(logMessage)); } finally { FileUtil.fullyDelete(tempLogDir); @@ -685,7 +686,7 @@ public class TestNMWebServices extends JerseyTestBase { private String getLogContext(String fullMessage) { String prefix = "LogContents:\n"; - String postfix = "End of LogFile:"; + String postfix = "End of LogType:"; int prefixIndex = fullMessage.indexOf(prefix) + prefix.length(); int postfixIndex = fullMessage.indexOf(postfix); return fullMessage.substring(prefixIndex, postfixIndex); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org