YARN-4422. Generic AHS sometimes doesn't show started, node, or logs on App page (Eric Payne via jeagles)

(cherry picked from commit 4ff973f96ae7f77cda3b52b38427e2991819ad31)
(cherry picked from commit 7c604c3d065ab15927ef7e14be6acf7772f6077f)
This commit is contained in:
Jonathan Eagles 2015-12-07 15:04:48 -06:00 committed by Wangda Tan
parent 46cb47c03e
commit c4ae007fd4
4 changed files with 24 additions and 2 deletions

View File

@ -1110,6 +1110,9 @@ Release 2.7.3 - UNRELEASED
YARN-4398. Remove unnecessary synchronization in RMStateStore. (Ning Ding via jianhe) YARN-4398. Remove unnecessary synchronization in RMStateStore. (Ning Ding via jianhe)
YARN-4422. Generic AHS sometimes doesn't show started, node, or logs on App page
(Eric Payne via jeagles)
Release 2.7.2 - UNRELEASED Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -488,6 +488,13 @@ private static ApplicationAttemptReport convertToApplicationAttemptReport(
AppAttemptMetricsConstants.STATE_EVENT_INFO) AppAttemptMetricsConstants.STATE_EVENT_INFO)
.toString()); .toString());
} }
if (eventInfo
.containsKey(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO)) {
amContainerId =
ConverterUtils.toContainerId(eventInfo.get(
AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO)
.toString());
}
} }
} }
} }

View File

@ -19,6 +19,7 @@
package org.apache.hadoop.yarn.server.resourcemanager.metrics; package org.apache.hadoop.yarn.server.resourcemanager.metrics;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState; import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState;
@ -31,6 +32,7 @@ public class AppAttemptFinishedEvent extends
private String diagnosticsInfo; private String diagnosticsInfo;
private FinalApplicationStatus appStatus; private FinalApplicationStatus appStatus;
private YarnApplicationAttemptState state; private YarnApplicationAttemptState state;
private ContainerId masterContainerId;
public AppAttemptFinishedEvent( public AppAttemptFinishedEvent(
ApplicationAttemptId appAttemptId, ApplicationAttemptId appAttemptId,
@ -39,7 +41,8 @@ public AppAttemptFinishedEvent(
String diagnosticsInfo, String diagnosticsInfo,
FinalApplicationStatus appStatus, FinalApplicationStatus appStatus,
YarnApplicationAttemptState state, YarnApplicationAttemptState state,
long finishedTime) { long finishedTime,
ContainerId masterContainerId) {
super(SystemMetricsEventType.APP_ATTEMPT_FINISHED, finishedTime); super(SystemMetricsEventType.APP_ATTEMPT_FINISHED, finishedTime);
this.appAttemptId = appAttemptId; this.appAttemptId = appAttemptId;
// This is the tracking URL after the application attempt is finished // This is the tracking URL after the application attempt is finished
@ -48,6 +51,7 @@ public AppAttemptFinishedEvent(
this.diagnosticsInfo = diagnosticsInfo; this.diagnosticsInfo = diagnosticsInfo;
this.appStatus = appStatus; this.appStatus = appStatus;
this.state = state; this.state = state;
this.masterContainerId = masterContainerId;
} }
@Override @Override
@ -79,4 +83,8 @@ public YarnApplicationAttemptState getYarnApplicationAttemptState() {
return state; return state;
} }
public ContainerId getMasterContainerId() {
return masterContainerId;
}
} }

View File

@ -188,7 +188,8 @@ public void appAttemptFinished(RMAppAttempt appAttempt,
// based on app state if it doesn't exist // based on app state if it doesn't exist
app.getFinalApplicationStatus(), app.getFinalApplicationStatus(),
RMServerUtils.createApplicationAttemptState(appAttemtpState), RMServerUtils.createApplicationAttemptState(appAttemtpState),
finishedTime)); finishedTime,
appAttempt.getMasterContainer().getId()));
} }
} }
@ -419,6 +420,9 @@ private void publishAppAttemptFinishedEvent(AppAttemptFinishedEvent event) {
event.getFinalApplicationStatus().toString()); event.getFinalApplicationStatus().toString());
eventInfo.put(AppAttemptMetricsConstants.STATE_EVENT_INFO, eventInfo.put(AppAttemptMetricsConstants.STATE_EVENT_INFO,
event.getYarnApplicationAttemptState().toString()); event.getYarnApplicationAttemptState().toString());
eventInfo.put(
AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO,
event.getMasterContainerId().toString());
tEvent.setEventInfo(eventInfo); tEvent.setEventInfo(eventInfo);
entity.addEvent(tEvent); entity.addEvent(tEvent);
putEntity(entity); putEntity(entity);