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 977a5bb65c..7e0f9123d4 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,6 +21,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.TreeSet; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -211,7 +212,10 @@ public static SummaryBuilder createAppSummary(RMApp app) { .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 adb638619b..23ac2e55ee 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 @@ -1072,6 +1072,7 @@ public void testEscapeApplicationSummary() { 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); @@ -1099,7 +1100,8 @@ public void testEscapeApplicationSummary() { assertTrue(msg.contains("preemptedNonAMContainers=10")); assertTrue(msg.contains("preemptedResources=")); assertTrue(msg.contains("applicationType=MAPREDUCE")); - } + assertTrue(msg.contains("applicationTags=tag1\\,tag2")); + } @Test public void testRMAppSubmitWithQueueChanged() throws Exception {