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
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
INCOMPATIBLE CHANGES

View File

@ -552,11 +552,18 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
}
}
private void setTrackingUrlToRMAppPage() {
private void setTrackingUrlToRMAppPage(RMAppAttemptState stateToBeStored) {
originalTrackingUrl = pjoin(
WebAppUtils.getResolvedRMWebAppURLWithScheme(conf),
"cluster", "app", getAppAttemptId().getApplicationId());
proxiedTrackingUrl = originalTrackingUrl;
switch (stateToBeStored) {
case KILLED:
case FAILED:
proxiedTrackingUrl = originalTrackingUrl;
break;
default:
break;
}
}
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
// StateStore
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;
int exitStatus = ContainerExitStatus.INVALID;
switch (event.getType()) {
@ -1099,6 +1109,7 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
RMAppAttemptUnregistrationEvent unregisterEvent =
(RMAppAttemptUnregistrationEvent) event;
diags = unregisterEvent.getDiagnostics();
// reset finalTrackingUrl to url sent by am
finalTrackingUrl = sanitizeTrackingUrl(unregisterEvent.getFinalTrackingUrl());
finalStatus = unregisterEvent.getFinalApplicationStatus();
break;
@ -1202,8 +1213,6 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
break;
case KILLED:
{
// don't leave the tracking URL pointing to a non-existent AM
appAttempt.setTrackingUrlToRMAppPage();
appAttempt.invalidateAMHostAndPort();
appEvent =
new RMAppFailedAttemptEvent(applicationId,
@ -1213,8 +1222,6 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
break;
case FAILED:
{
// don't leave the tracking URL pointing to a non-existent AM
appAttempt.setTrackingUrlToRMAppPage();
appAttempt.invalidateAMHostAndPort();
if (appAttempt.submissionContext

View File

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

View File

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