YARN-5100. The YarnApplicationState is always running in ATS even application is finished. Contributed by Xuan Gong.
(cherry picked from commit141873ca7d
) (cherry picked from commit416274b53e
)
This commit is contained in:
parent
7a001ae19b
commit
c8843cac03
|
@ -358,6 +358,9 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
|
||||||
createdTime = event.getTimestamp();
|
createdTime = event.getTimestamp();
|
||||||
} else if (event.getEventType().equals(
|
} else if (event.getEventType().equals(
|
||||||
ApplicationMetricsConstants.UPDATED_EVENT_TYPE)) {
|
ApplicationMetricsConstants.UPDATED_EVENT_TYPE)) {
|
||||||
|
// TODO: YARN-5101. This type of events are parsed in
|
||||||
|
// time-stamp descending order which means the previous event
|
||||||
|
// could override the information from the later same type of event.
|
||||||
Map<String, Object> eventInfo = event.getEventInfo();
|
Map<String, Object> eventInfo = event.getEventInfo();
|
||||||
if (eventInfo == null) {
|
if (eventInfo == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -376,8 +379,10 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
|
||||||
}
|
}
|
||||||
if (eventInfo.containsKey(
|
if (eventInfo.containsKey(
|
||||||
ApplicationMetricsConstants.STATE_EVENT_INFO)) {
|
ApplicationMetricsConstants.STATE_EVENT_INFO)) {
|
||||||
state = YarnApplicationState.valueOf(eventInfo.get(
|
if (!isFinalState(state)) {
|
||||||
ApplicationMetricsConstants.STATE_EVENT_INFO).toString());
|
state = YarnApplicationState.valueOf(eventInfo.get(
|
||||||
|
ApplicationMetricsConstants.STATE_EVENT_INFO).toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (event.getEventType().equals(
|
} else if (event.getEventType().equals(
|
||||||
ApplicationMetricsConstants.FINISHED_EVENT_TYPE)) {
|
ApplicationMetricsConstants.FINISHED_EVENT_TYPE)) {
|
||||||
|
@ -429,6 +434,12 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
|
||||||
amNodeLabelExpression), appViewACLs);
|
amNodeLabelExpression), appViewACLs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isFinalState(YarnApplicationState state) {
|
||||||
|
return state == YarnApplicationState.FINISHED
|
||||||
|
|| state == YarnApplicationState.FAILED
|
||||||
|
|| state == YarnApplicationState.KILLED;
|
||||||
|
}
|
||||||
|
|
||||||
private static ApplicationAttemptReport convertToApplicationAttemptReport(
|
private static ApplicationAttemptReport convertToApplicationAttemptReport(
|
||||||
TimelineEntity entity) {
|
TimelineEntity entity) {
|
||||||
String host = null;
|
String host = null;
|
||||||
|
|
|
@ -537,6 +537,18 @@ public class TestApplicationHistoryManagerOnTimelineStore {
|
||||||
}
|
}
|
||||||
tEvent.setEventInfo(eventInfo);
|
tEvent.setEventInfo(eventInfo);
|
||||||
entity.addEvent(tEvent);
|
entity.addEvent(tEvent);
|
||||||
|
// send a YARN_APPLICATION_STATE_UPDATED event
|
||||||
|
// after YARN_APPLICATION_FINISHED
|
||||||
|
// The final YarnApplicationState should not be changed
|
||||||
|
tEvent = new TimelineEvent();
|
||||||
|
tEvent.setEventType(
|
||||||
|
ApplicationMetricsConstants.STATE_UPDATED_EVENT_TYPE);
|
||||||
|
tEvent.setTimestamp(Integer.MAX_VALUE + 4L + appId.getId());
|
||||||
|
eventInfo = new HashMap<String, Object>();
|
||||||
|
eventInfo.put(ApplicationMetricsConstants.STATE_EVENT_INFO,
|
||||||
|
YarnApplicationState.KILLED);
|
||||||
|
tEvent.setEventInfo(eventInfo);
|
||||||
|
entity.addEvent(tEvent);
|
||||||
if (enableUpdateEvent) {
|
if (enableUpdateEvent) {
|
||||||
tEvent = new TimelineEvent();
|
tEvent = new TimelineEvent();
|
||||||
createAppModifiedEvent(appId, tEvent, "changed queue", 5);
|
createAppModifiedEvent(appId, tEvent, "changed queue", 5);
|
||||||
|
|
Loading…
Reference in New Issue