YARN-9763. Print application tags in application summary. Contributed by Manoj Kumar

This commit is contained in:
Jonathan Hung 2019-09-06 10:48:30 -07:00
parent a23417533e
commit b71a7f195c
2 changed files with 8 additions and 2 deletions

View File

@ -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.<String>emptySet()));
return summary;
}

View File

@ -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<String, Long> 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=<memory:1234\\, vCores:56>"));
assertTrue(msg.contains("applicationType=MAPREDUCE"));
}
assertTrue(msg.contains("applicationTags=tag1\\,tag2"));
}
@Test
public void testRMAppSubmitWithQueueChanged() throws Exception {