diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java index 34121883c7b..2ec02f469c7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java @@ -21,7 +21,7 @@ import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map; - +import java.util.TreeSet; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; @@ -195,7 +195,10 @@ public class RMAppManager implements EventHandler, .getResourceSecondsString(metrics.getResourceSecondsMap())) .add("preemptedResourceSeconds", StringHelper .getResourceSecondsString( - metrics.getPreemptedResourceSecondsMap())); + metrics.getPreemptedResourceSecondsMap())) + .add("applicationTags", StringHelper.CSV_JOINER.join( + app.getApplicationTags() != null ? new TreeSet<>( + app.getApplicationTags()) : Collections.emptySet())); return summary; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java index 187fa3ec7fd..584fe944f14 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAppManager.java @@ -101,6 +101,7 @@ import org.mockito.stubbing.Answer; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.google.common.collect.Sets; /** * Testing applications being retired from RM. @@ -831,6 +832,7 @@ public class TestAppManager{ when(app.getApplicationType()).thenReturn("MAPREDUCE"); when(app.getSubmitTime()).thenReturn(1000L); when(app.getLaunchTime()).thenReturn(2000L); + when(app.getApplicationTags()).thenReturn(Sets.newHashSet("tag2", "tag1")); Map resourceSecondsMap = new HashMap<>(); resourceSecondsMap.put(ResourceInformation.MEMORY_MB.getName(), 16384L); resourceSecondsMap.put(ResourceInformation.VCORES.getName(), 64L); @@ -858,6 +860,7 @@ public class TestAppManager{ Assert.assertTrue(msg.contains("preemptedNonAMContainers=10")); Assert.assertTrue(msg.contains("preemptedResources=")); Assert.assertTrue(msg.contains("applicationType=MAPREDUCE")); + Assert.assertTrue(msg.contains("applicationTags=tag1\\,tag2")); } @Test