YARN-3151. On Failover tracking url wrong in application cli for KILLED

application. Contributed by Rohith
This commit is contained in:
Xuan 2015-02-11 21:19:48 -08:00
parent 8a54384a0a
commit 65c69e296e
4 changed files with 22 additions and 8 deletions

View File

@ -549,6 +549,9 @@ Release 2.7.0 - UNRELEASED
YARN-3074. Nodemanager dies when localizer runner tries to write to a full YARN-3074. Nodemanager dies when localizer runner tries to write to a full
disk (Varun Saxena via jlowe) disk (Varun Saxena via jlowe)
YARN-3151. On Failover tracking url wrong in application cli for
KILLED application (Rohith via xgong)
Release 2.6.0 - 2014-11-18 Release 2.6.0 - 2014-11-18
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -552,11 +552,18 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
} }
} }
private void setTrackingUrlToRMAppPage() { private void setTrackingUrlToRMAppPage(RMAppAttemptState stateToBeStored) {
originalTrackingUrl = pjoin( originalTrackingUrl = pjoin(
WebAppUtils.getResolvedRMWebAppURLWithScheme(conf), WebAppUtils.getResolvedRMWebAppURLWithScheme(conf),
"cluster", "app", getAppAttemptId().getApplicationId()); "cluster", "app", getAppAttemptId().getApplicationId());
proxiedTrackingUrl = originalTrackingUrl; switch (stateToBeStored) {
case KILLED:
case FAILED:
proxiedTrackingUrl = originalTrackingUrl;
break;
default:
break;
}
} }
private void invalidateAMHostAndPort() { private void invalidateAMHostAndPort() {
@ -1083,7 +1090,10 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
// These fields can be visible from outside only after they are saved in // These fields can be visible from outside only after they are saved in
// StateStore // StateStore
String diags = null; String diags = null;
String finalTrackingUrl = null;
// don't leave the tracking URL pointing to a non-existent AM
setTrackingUrlToRMAppPage(stateToBeStored);
String finalTrackingUrl = getOriginalTrackingUrl();
FinalApplicationStatus finalStatus = null; FinalApplicationStatus finalStatus = null;
int exitStatus = ContainerExitStatus.INVALID; int exitStatus = ContainerExitStatus.INVALID;
switch (event.getType()) { switch (event.getType()) {
@ -1099,6 +1109,7 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
RMAppAttemptUnregistrationEvent unregisterEvent = RMAppAttemptUnregistrationEvent unregisterEvent =
(RMAppAttemptUnregistrationEvent) event; (RMAppAttemptUnregistrationEvent) event;
diags = unregisterEvent.getDiagnostics(); diags = unregisterEvent.getDiagnostics();
// reset finalTrackingUrl to url sent by am
finalTrackingUrl = sanitizeTrackingUrl(unregisterEvent.getFinalTrackingUrl()); finalTrackingUrl = sanitizeTrackingUrl(unregisterEvent.getFinalTrackingUrl());
finalStatus = unregisterEvent.getFinalApplicationStatus(); finalStatus = unregisterEvent.getFinalApplicationStatus();
break; break;
@ -1202,8 +1213,6 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
break; break;
case KILLED: case KILLED:
{ {
// don't leave the tracking URL pointing to a non-existent AM
appAttempt.setTrackingUrlToRMAppPage();
appAttempt.invalidateAMHostAndPort(); appAttempt.invalidateAMHostAndPort();
appEvent = appEvent =
new RMAppFailedAttemptEvent(applicationId, new RMAppFailedAttemptEvent(applicationId,
@ -1213,8 +1222,6 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
break; break;
case FAILED: case FAILED:
{ {
// don't leave the tracking URL pointing to a non-existent AM
appAttempt.setTrackingUrlToRMAppPage();
appAttempt.invalidateAMHostAndPort(); appAttempt.invalidateAMHostAndPort();
if (appAttempt.submissionContext if (appAttempt.submissionContext

View File

@ -769,6 +769,8 @@ public class TestRMRestart extends ParameterizedSchedulerTestBase {
Assert.assertEquals(RMAppState.KILLED, appState.getState()); Assert.assertEquals(RMAppState.KILLED, appState.getState());
Assert.assertEquals(RMAppAttemptState.KILLED, Assert.assertEquals(RMAppAttemptState.KILLED,
appState.getAttempt(am0.getApplicationAttemptId()).getState()); appState.getAttempt(am0.getApplicationAttemptId()).getState());
String trackingUrl = app0.getCurrentAppAttempt().getOriginalTrackingUrl();
Assert.assertNotNull(trackingUrl);
// restart rm // restart rm
MockRM rm2 = createMockRM(conf, memStore); MockRM rm2 = createMockRM(conf, memStore);
@ -782,6 +784,8 @@ public class TestRMRestart extends ParameterizedSchedulerTestBase {
ApplicationReport appReport = verifyAppReportAfterRMRestart(app0, rm2); ApplicationReport appReport = verifyAppReportAfterRMRestart(app0, rm2);
Assert.assertEquals(app0.getDiagnostics().toString(), Assert.assertEquals(app0.getDiagnostics().toString(),
appReport.getDiagnostics()); appReport.getDiagnostics());
Assert.assertEquals(trackingUrl, loadedApp0.getCurrentAppAttempt()
.getOriginalTrackingUrl());
} }
@Test (timeout = 60000) @Test (timeout = 60000)

View File

@ -1491,7 +1491,7 @@ public class TestRMAppAttemptTransitions {
diagnostics.contains("exitCode: " + exitCode)); diagnostics.contains("exitCode: " + exitCode));
if (shouldCheckURL) { if (shouldCheckURL) {
assertTrue("Diagnostic information does not contain application proxy URL", assertTrue("Diagnostic information does not contain application proxy URL",
diagnostics.contains(applicationAttempt.getWebProxyBase())); diagnostics.contains(applicationAttempt.getTrackingUrl()));
} }
} }