From 3648cb57c9f018a3a339c26f5a0ca2779485521a Mon Sep 17 00:00:00 2001 From: Zhijie Shen Date: Thu, 13 Nov 2014 13:47:42 -0800 Subject: [PATCH] YARN-2766. Made ApplicationHistoryManager return a sorted list of apps, attempts and containers. Contributed by Robert Kanter. --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../ApplicationHistoryManagerOnTimelineStore.java | 7 ++++--- .../TestApplicationHistoryClientService.java | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 60f88ca6cc..5c794bd750 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -81,6 +81,9 @@ Release 2.7.0 - UNRELEASED YARN-2713. "RM Home" link in NM should point to one of the RMs in an HA setup. (kasha) + YARN-2766. Made ApplicationHistoryManager return a sorted list of apps, + attempts and containers. (Robert Kanter via zjshen) + Release 2.6.0 - 2014-11-18 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 cd429d0230..c88ccccf72 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 @@ -21,6 +21,7 @@ import java.io.IOException; import java.util.EnumSet; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -102,7 +103,7 @@ public Map getAllApplications() null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map apps = - new HashMap(); + new LinkedHashMap(); if (entities != null && entities.getEntities() != null) { for (TimelineEntity entity : entities.getEntities()) { ApplicationReportExt app = @@ -128,7 +129,7 @@ public Map getAllApplications() Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map appAttempts = - new HashMap(); + new LinkedHashMap(); for (TimelineEntity entity : entities.getEntities()) { ApplicationAttemptReport appAttempt = convertToApplicationAttemptReport(entity); @@ -198,7 +199,7 @@ public Map getContainers( null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); Map containers = - new HashMap(); + new LinkedHashMap(); if (entities != null && entities.getEntities() != null) { for (TimelineEntity entity : entities.getEntities()) { ContainerReport container = convertToContainerReport( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java index 7c2593d9e0..2a38d0a4bd 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java @@ -168,7 +168,7 @@ public void testContainers() throws IOException, YarnException { clientService.getClientHandler().getContainers(request); List containers = response.getContainerList(); Assert.assertNotNull(containers); - Assert.assertEquals(containerId, containers.get(1).getContainerId()); - Assert.assertEquals(containerId1, containers.get(0).getContainerId()); + Assert.assertEquals(containerId, containers.get(0).getContainerId()); + Assert.assertEquals(containerId1, containers.get(1).getContainerId()); } }