YARN-10116. Expose diagnostics in RMAppManager summary

(cherry picked from commit 314e2f9d2e)
(cherry picked from commit 147897da4b420b4749f3c7b410f4c329632c3352)
(cherry picked from commit fa35b8370ce14c9b8ee911b73fda380817b964fd)
This commit is contained in:
Jonathan Hung 2020-02-04 13:52:25 -08:00
parent b97fdb7b4c
commit 4fce8c8023
2 changed files with 6 additions and 1 deletions

View File

@ -208,7 +208,8 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
== null == null
? "" ? ""
: app.getApplicationSubmissionContext() : app.getApplicationSubmissionContext()
.getNodeLabelExpression()); .getNodeLabelExpression())
.add("diagnostics", app.getDiagnostics());
return summary; return summary;
} }

View File

@ -844,6 +844,8 @@ public class TestAppManager{
new RMAppMetrics(Resource.newInstance(1234, 56), new RMAppMetrics(Resource.newInstance(1234, 56),
10, 1, resourceSecondsMap, new HashMap<String, Long>()); 10, 1, resourceSecondsMap, new HashMap<String, Long>());
when(app.getRMAppMetrics()).thenReturn(metrics); when(app.getRMAppMetrics()).thenReturn(metrics);
when(app.getDiagnostics()).thenReturn(new StringBuilder(
"Multiline\n\n\r\rDiagnostics=Diagn,ostic"));
RMAppManager.ApplicationSummary.SummaryBuilder summary = RMAppManager.ApplicationSummary.SummaryBuilder summary =
new RMAppManager.ApplicationSummary().createAppSummary(app); new RMAppManager.ApplicationSummary().createAppSummary(app);
@ -866,6 +868,8 @@ public class TestAppManager{
Assert.assertTrue(msg.contains("applicationType=MAPREDUCE")); Assert.assertTrue(msg.contains("applicationType=MAPREDUCE"));
Assert.assertTrue(msg.contains("applicationTags=tag1\\,tag2")); Assert.assertTrue(msg.contains("applicationTags=tag1\\,tag2"));
Assert.assertTrue(msg.contains("applicationNodeLabel=test")); Assert.assertTrue(msg.contains("applicationNodeLabel=test"));
Assert.assertTrue(msg.contains("diagnostics=Multiline" + escaped
+ "Diagnostics\\=Diagn\\,ostic"));
} }
@Test @Test