From 19a4feaf6fcf42ebbfe98b8a7153ade96d37fb14 Mon Sep 17 00:00:00 2001 From: Xuan Date: Tue, 7 Apr 2015 08:22:39 -0700 Subject: [PATCH] YARN-3110. Few issues in ApplicationHistory web ui. Contributed by Naganarasimha G R --- hadoop-yarn-project/CHANGES.txt | 2 ++ .../ApplicationHistoryManagerOnTimelineStore.java | 8 +++++--- .../hadoop/yarn/server/webapp/AppAttemptBlock.java | 13 +++++++------ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index efb815376d4..278636d2a8c 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -148,6 +148,8 @@ Release 2.8.0 - UNRELEASED YARN-2429. TestAMRMTokens.testTokenExpiry fails Intermittently with error message:Invalid AMRMToken (zxu via rkanter) + YARN-3110. Few issues in ApplicationHistory web ui. (Naganarasimha G R via xgong) + Release 2.7.0 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java index 49041c75cf5..db00d2ce69d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java @@ -219,10 +219,11 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService String type = null; long createdTime = 0; long finishedTime = 0; + float progress = 0.0f; ApplicationAttemptId latestApplicationAttemptId = null; String diagnosticsInfo = null; FinalApplicationStatus finalStatus = FinalApplicationStatus.UNDEFINED; - YarnApplicationState state = null; + YarnApplicationState state = YarnApplicationState.ACCEPTED; ApplicationResourceUsageReport appResources = null; Map appViewACLs = new HashMap(); @@ -245,7 +246,7 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService ConverterUtils.toApplicationId(entity.getEntityId()), latestApplicationAttemptId, user, queue, name, null, -1, null, state, diagnosticsInfo, null, createdTime, finishedTime, finalStatus, null, - null, 1.0F, type, null), appViewACLs); + null, progress, type, null), appViewACLs); } if (entityInfo.containsKey(ApplicationMetricsConstants.QUEUE_ENTITY_INFO)) { queue = @@ -279,6 +280,7 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService createdTime = event.getTimestamp(); } else if (event.getEventType().equals( ApplicationMetricsConstants.FINISHED_EVENT_TYPE)) { + progress=1.0F; finishedTime = event.getTimestamp(); Map eventInfo = event.getEventInfo(); if (eventInfo == null) { @@ -321,7 +323,7 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService ConverterUtils.toApplicationId(entity.getEntityId()), latestApplicationAttemptId, user, queue, name, null, -1, null, state, diagnosticsInfo, null, createdTime, finishedTime, finalStatus, appResources, - null, 1.0F, type, null), appViewACLs); + null, progress, type, null), appViewACLs); } private static ApplicationAttemptReport convertToApplicationAttemptReport( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java index 8df94e694db..8695c6cc6f3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java @@ -194,17 +194,18 @@ public class AppAttemptBlock extends HtmlBlock { protected void generateOverview(ApplicationAttemptReport appAttemptReport, Collection containers, AppAttemptInfo appAttempt, String node) { + String amContainerId = appAttempt.getAmContainerId(); info("Application Attempt Overview") ._( "Application Attempt State:", appAttempt.getAppAttemptState() == null ? UNAVAILABLE : appAttempt .getAppAttemptState()) - ._( - "AM Container:", - appAttempt.getAmContainerId() == null || containers == null - || !hasAMContainer(appAttemptReport.getAMContainerId(), containers) - ? null : root_url("container", appAttempt.getAmContainerId()), - String.valueOf(appAttempt.getAmContainerId())) + ._("AM Container:", + amContainerId == null + || containers == null + || !hasAMContainer(appAttemptReport.getAMContainerId(), + containers) ? null : root_url("container", amContainerId), + amContainerId == null ? "N/A" : amContainerId) ._("Node:", node) ._( "Tracking URL:",