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 1f685efc73
commit 9c9ff07249
2 changed files with 8 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeSet;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
@ -207,7 +208,10 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
.getResourceSecondsString(metrics.getResourceSecondsMap())) .getResourceSecondsString(metrics.getResourceSecondsMap()))
.add("preemptedResourceSeconds", StringHelper .add("preemptedResourceSeconds", StringHelper
.getResourceSecondsString( .getResourceSecondsString(
metrics.getPreemptedResourceSecondsMap())); metrics.getPreemptedResourceSecondsMap()))
.add("applicationTags", StringHelper.CSV_JOINER.join(
app.getApplicationTags() != null ? new TreeSet<>(
app.getApplicationTags()) : Collections.<String>emptySet()));
return summary; return summary;
} }

View File

@ -1071,6 +1071,7 @@ public class TestAppManager extends AppManagerTestBase{
when(app.getApplicationType()).thenReturn("MAPREDUCE"); when(app.getApplicationType()).thenReturn("MAPREDUCE");
when(app.getSubmitTime()).thenReturn(1000L); when(app.getSubmitTime()).thenReturn(1000L);
when(app.getLaunchTime()).thenReturn(2000L); when(app.getLaunchTime()).thenReturn(2000L);
when(app.getApplicationTags()).thenReturn(Sets.newHashSet("tag2", "tag1"));
Map<String, Long> resourceSecondsMap = new HashMap<>(); Map<String, Long> resourceSecondsMap = new HashMap<>();
resourceSecondsMap.put(ResourceInformation.MEMORY_MB.getName(), 16384L); resourceSecondsMap.put(ResourceInformation.MEMORY_MB.getName(), 16384L);
resourceSecondsMap.put(ResourceInformation.VCORES.getName(), 64L); resourceSecondsMap.put(ResourceInformation.VCORES.getName(), 64L);
@ -1098,7 +1099,8 @@ public class TestAppManager extends AppManagerTestBase{
assertTrue(msg.contains("preemptedNonAMContainers=10")); assertTrue(msg.contains("preemptedNonAMContainers=10"));
assertTrue(msg.contains("preemptedResources=<memory:1234\\, vCores:56>")); assertTrue(msg.contains("preemptedResources=<memory:1234\\, vCores:56>"));
assertTrue(msg.contains("applicationType=MAPREDUCE")); assertTrue(msg.contains("applicationType=MAPREDUCE"));
} assertTrue(msg.contains("applicationTags=tag1\\,tag2"));
}
@Test @Test
public void testRMAppSubmitWithQueueChanged() throws Exception { public void testRMAppSubmitWithQueueChanged() throws Exception {