Skip to content

Commit

Permalink
YARN-9764. Print application submission context label in application …
Browse files Browse the repository at this point in the history
…summary. Contributed by Manoj Kumar
  • Loading branch information
hungj committed Sep 9, 2019
1 parent ca32917 commit 43e389b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.<String>emptySet()));
app.getApplicationTags()) : Collections.<String>emptySet()))
.add("applicationNodeLabel",
app.getApplicationSubmissionContext().getNodeLabelExpression()
== null
? ""
: app.getApplicationSubmissionContext()
.getNodeLabelExpression());

return summary;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -1101,6 +1104,7 @@ public void testEscapeApplicationSummary() {
assertTrue(msg.contains("preemptedResources=<memory:1234\\, vCores:56>"));
assertTrue(msg.contains("applicationType=MAPREDUCE"));
assertTrue(msg.contains("applicationTags=tag1\\,tag2"));
assertTrue(msg.contains("applicationNodeLabel=test"));
}

@Test
Expand Down

0 comments on commit 43e389b

Please sign in to comment.