YARN-2542. Fixed NPE when retrieving ApplicationReport from TimeLineServer. Contributed by Zhijie Shen
(cherry picked from commit a0ad975ea1
)
This commit is contained in:
parent
add5ac6a73
commit
09ad86d70c
|
@ -320,6 +320,9 @@ Release 2.6.0 - UNRELEASED
|
|||
YARN-2456. Possible livelock in CapacityScheduler when RM is recovering apps.
|
||||
(Jian He via xgong)
|
||||
|
||||
YARN-2542. Fixed NPE when retrieving ApplicationReport from TimeLineServer.
|
||||
(Zhijie Shen via jianhe)
|
||||
|
||||
Release 2.5.1 - 2014-09-05
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -463,9 +463,15 @@ public class ApplicationCLI extends YarnCLI {
|
|||
appReportStr.println(appReport.getHost());
|
||||
appReportStr.print("\tAggregate Resource Allocation : ");
|
||||
|
||||
ApplicationResourceUsageReport usageReport = appReport.getApplicationResourceUsageReport();
|
||||
ApplicationResourceUsageReport usageReport =
|
||||
appReport.getApplicationResourceUsageReport();
|
||||
if (usageReport != null) {
|
||||
//completed app report in the timeline server doesn't have usage report
|
||||
appReportStr.print(usageReport.getMemorySeconds() + " MB-seconds, ");
|
||||
appReportStr.println(usageReport.getVcoreSeconds() + " vcore-seconds");
|
||||
} else {
|
||||
appReportStr.println("N/A");
|
||||
}
|
||||
appReportStr.print("\tDiagnostics : ");
|
||||
appReportStr.print(appReport.getDiagnostics());
|
||||
} else {
|
||||
|
|
|
@ -86,9 +86,10 @@ public class TestYarnCLI {
|
|||
|
||||
@Test
|
||||
public void testGetApplicationReport() throws Exception {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ApplicationCLI cli = createAndGetAppCLI();
|
||||
ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
|
||||
ApplicationResourceUsageReport usageReport =
|
||||
ApplicationResourceUsageReport usageReport = i == 0 ? null :
|
||||
ApplicationResourceUsageReport.newInstance(
|
||||
2, 0, null, null, null, 123456, 4567);
|
||||
ApplicationReport newApplicationReport = ApplicationReport.newInstance(
|
||||
|
@ -101,7 +102,7 @@ public class TestYarnCLI {
|
|||
newApplicationReport);
|
||||
int result = cli.run(new String[] { "application", "-status", applicationId.toString() });
|
||||
assertEquals(0, result);
|
||||
verify(client).getApplicationReport(applicationId);
|
||||
verify(client, times(1 + i)).getApplicationReport(applicationId);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PrintWriter pw = new PrintWriter(baos);
|
||||
pw.println("Application Report : ");
|
||||
|
@ -118,12 +119,15 @@ public class TestYarnCLI {
|
|||
pw.println("\tTracking-URL : N/A");
|
||||
pw.println("\tRPC Port : 124");
|
||||
pw.println("\tAM Host : host");
|
||||
pw.println("\tAggregate Resource Allocation : 123456 MB-seconds, 4567 vcore-seconds");
|
||||
pw.println("\tAggregate Resource Allocation : " +
|
||||
(i == 0 ? "N/A" : "123456 MB-seconds, 4567 vcore-seconds"));
|
||||
pw.println("\tDiagnostics : diagnostics");
|
||||
pw.close();
|
||||
String appReportStr = baos.toString("UTF-8");
|
||||
Assert.assertEquals(appReportStr, sysOutStream.toString());
|
||||
verify(sysOut, times(1)).println(isA(String.class));
|
||||
sysOutStream.reset();
|
||||
verify(sysOut, times(1 + i)).println(isA(String.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue