YARN-4246. NPE while listing app attempt. (Nijel S F via rohithsharmaks)
This commit is contained in:
parent
1aa735c188
commit
b57f08c0d2
@ -997,6 +997,8 @@ Release 2.8.0 - UNRELEASED
|
|||||||
|
|
||||||
YARN-3724. Use POSIX nftw(3) instead of fts(3) (Alan Burlison via aw)
|
YARN-3724. Use POSIX nftw(3) instead of fts(3) (Alan Burlison via aw)
|
||||||
|
|
||||||
|
YARN-4246. NPE while listing app attempt. (Nijel S F via rohithsharmaks)
|
||||||
|
|
||||||
Release 2.7.2 - UNRELEASED
|
Release 2.7.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -349,8 +349,9 @@ private int printApplicationAttemptReport(String applicationAttemptId)
|
|||||||
appAttemptReportStr.println(appAttemptReport
|
appAttemptReportStr.println(appAttemptReport
|
||||||
.getYarnApplicationAttemptState());
|
.getYarnApplicationAttemptState());
|
||||||
appAttemptReportStr.print("\tAMContainer : ");
|
appAttemptReportStr.print("\tAMContainer : ");
|
||||||
appAttemptReportStr.println(appAttemptReport.getAMContainerId()
|
appAttemptReportStr
|
||||||
.toString());
|
.println(appAttemptReport.getAMContainerId() == null ? "N/A"
|
||||||
|
: appAttemptReport.getAMContainerId().toString());
|
||||||
appAttemptReportStr.print("\tTracking-URL : ");
|
appAttemptReportStr.print("\tTracking-URL : ");
|
||||||
appAttemptReportStr.println(appAttemptReport.getTrackingUrl());
|
appAttemptReportStr.println(appAttemptReport.getTrackingUrl());
|
||||||
appAttemptReportStr.print("\tRPC Port : ");
|
appAttemptReportStr.print("\tRPC Port : ");
|
||||||
@ -667,6 +668,7 @@ private void listApplicationAttempts(String applicationId) throws YarnException,
|
|||||||
writer.printf(APPLICATION_ATTEMPTS_PATTERN, appAttemptReport
|
writer.printf(APPLICATION_ATTEMPTS_PATTERN, appAttemptReport
|
||||||
.getApplicationAttemptId(), appAttemptReport
|
.getApplicationAttemptId(), appAttemptReport
|
||||||
.getYarnApplicationAttemptState(), appAttemptReport
|
.getYarnApplicationAttemptState(), appAttemptReport
|
||||||
|
.getAMContainerId() == null ? "N/A" : appAttemptReport
|
||||||
.getAMContainerId().toString(), appAttemptReport.getTrackingUrl());
|
.getAMContainerId().toString(), appAttemptReport.getTrackingUrl());
|
||||||
}
|
}
|
||||||
writer.flush();
|
writer.flush();
|
||||||
|
@ -1590,4 +1590,27 @@ private String createNodeCLIHelpMessage() throws IOException {
|
|||||||
private static String normalize(String s) {
|
private static String normalize(String s) {
|
||||||
return SPACES_PATTERN.matcher(s).replaceAll(" "); // single space
|
return SPACES_PATTERN.matcher(s).replaceAll(" "); // single space
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAppAttemptReportWhileContainerIsNotAssigned()
|
||||||
|
throws Exception {
|
||||||
|
ApplicationCLI cli = createAndGetAppCLI();
|
||||||
|
ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
|
||||||
|
ApplicationAttemptId attemptId =
|
||||||
|
ApplicationAttemptId.newInstance(applicationId, 1);
|
||||||
|
ApplicationAttemptReport attemptReport =
|
||||||
|
ApplicationAttemptReport.newInstance(attemptId, "host", 124, "url",
|
||||||
|
"oUrl", "diagnostics", YarnApplicationAttemptState.SCHEDULED, null,
|
||||||
|
1000l, 2000l);
|
||||||
|
when(client.getApplicationAttemptReport(any(ApplicationAttemptId.class)))
|
||||||
|
.thenReturn(attemptReport);
|
||||||
|
int result =
|
||||||
|
cli.run(new String[] { "applicationattempt", "-status",
|
||||||
|
attemptId.toString() });
|
||||||
|
assertEquals(0, result);
|
||||||
|
result =
|
||||||
|
cli.run(new String[] { "applicationattempt", "-list",
|
||||||
|
applicationId.toString() });
|
||||||
|
assertEquals(0, result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user