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 7e0f9123d4..1b91ba090f 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 @@ -215,7 +215,14 @@ public static SummaryBuilder createAppSummary(RMApp app) { metrics.getPreemptedResourceSecondsMap())) .add("applicationTags", StringHelper.CSV_JOINER.join( app.getApplicationTags() != null ? new TreeSet<>( - app.getApplicationTags()) : Collections.emptySet())); + app.getApplicationTags()) : Collections.emptySet())) + .add("applicationNodeLabel", + app.getApplicationSubmissionContext().getNodeLabelExpression() + == null + ? "" + : app.getApplicationSubmissionContext() + .getNodeLabelExpression()); + 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 23ac2e55ee..906f1162b3 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 @@ -1063,6 +1063,9 @@ public void testRMAppSubmitInvalidResourceRequest() throws Exception { @Test (timeout = 30000) public void testEscapeApplicationSummary() { RMApp app = mock(RMAppImpl.class); + ApplicationSubmissionContext asc = mock(ApplicationSubmissionContext.class); + when(asc.getNodeLabelExpression()).thenReturn("test"); + when(app.getApplicationSubmissionContext()).thenReturn(asc); when(app.getApplicationId()).thenReturn( ApplicationId.newInstance(100L, 1)); when(app.getName()).thenReturn("Multiline\n\n\r\rAppName"); @@ -1101,6 +1104,7 @@ public void testEscapeApplicationSummary() { assertTrue(msg.contains("preemptedResources=")); assertTrue(msg.contains("applicationType=MAPREDUCE")); assertTrue(msg.contains("applicationTags=tag1\\,tag2")); + assertTrue(msg.contains("applicationNodeLabel=test")); } @Test