YARN-2766. Made ApplicationHistoryManager return a sorted list of apps, attempts and containers. Contributed by Robert Kanter.

This commit is contained in:
Zhijie Shen 2014-11-13 13:47:42 -08:00
parent 4ae9780e6a
commit 3648cb57c9
3 changed files with 9 additions and 5 deletions

View File

@ -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

View File

@ -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<ApplicationId, ApplicationReport> getAllApplications()
null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class),
UserGroupInformation.getLoginUser());
Map<ApplicationId, ApplicationReport> apps =
new HashMap<ApplicationId, ApplicationReport>();
new LinkedHashMap<ApplicationId, ApplicationReport>();
if (entities != null && entities.getEntities() != null) {
for (TimelineEntity entity : entities.getEntities()) {
ApplicationReportExt app =
@ -128,7 +129,7 @@ public Map<ApplicationId, ApplicationReport> getAllApplications()
Long.MAX_VALUE, EnumSet.allOf(Field.class),
UserGroupInformation.getLoginUser());
Map<ApplicationAttemptId, ApplicationAttemptReport> appAttempts =
new HashMap<ApplicationAttemptId, ApplicationAttemptReport>();
new LinkedHashMap<ApplicationAttemptId, ApplicationAttemptReport>();
for (TimelineEntity entity : entities.getEntities()) {
ApplicationAttemptReport appAttempt =
convertToApplicationAttemptReport(entity);
@ -198,7 +199,7 @@ public Map<ContainerId, ContainerReport> getContainers(
null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class),
UserGroupInformation.getLoginUser());
Map<ContainerId, ContainerReport> containers =
new HashMap<ContainerId, ContainerReport>();
new LinkedHashMap<ContainerId, ContainerReport>();
if (entities != null && entities.getEntities() != null) {
for (TimelineEntity entity : entities.getEntities()) {
ContainerReport container = convertToContainerReport(

View File

@ -168,7 +168,7 @@ public void testContainers() throws IOException, YarnException {
clientService.getClientHandler().getContainers(request);
List<ContainerReport> 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());
}
}