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

(cherry picked from commit 3648cb57c9)
(cherry picked from commit 53d6c91df9)
This commit is contained in:
Zhijie Shen 2014-11-13 13:47:42 -08:00 committed by Vinod Kumar Vavilapalli
parent fb096b97cc
commit 0f33fcd507
3 changed files with 9 additions and 5 deletions

View File

@ -141,6 +141,9 @@ Release 2.6.1 - UNRELEASED
YARN-3526. ApplicationMaster tracking URL is incorrectly redirected YARN-3526. ApplicationMaster tracking URL is incorrectly redirected
on a QJM cluster. (Weiwei Yang via xgong) on a QJM cluster. (Weiwei Yang via xgong)
YARN-2766. Made ApplicationHistoryManager return a sorted list of apps,
attempts and containers. (Robert Kanter via zjshen)
Release 2.6.0 - 2014-11-18 Release 2.6.0 - 2014-11-18
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.server.applicationhistoryservice;
import java.io.IOException; import java.io.IOException;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -102,7 +103,7 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class),
UserGroupInformation.getLoginUser()); UserGroupInformation.getLoginUser());
Map<ApplicationId, ApplicationReport> apps = Map<ApplicationId, ApplicationReport> apps =
new HashMap<ApplicationId, ApplicationReport>(); new LinkedHashMap<ApplicationId, ApplicationReport>();
if (entities != null && entities.getEntities() != null) { if (entities != null && entities.getEntities() != null) {
for (TimelineEntity entity : entities.getEntities()) { for (TimelineEntity entity : entities.getEntities()) {
ApplicationReportExt app = ApplicationReportExt app =
@ -128,7 +129,7 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
Long.MAX_VALUE, EnumSet.allOf(Field.class), Long.MAX_VALUE, EnumSet.allOf(Field.class),
UserGroupInformation.getLoginUser()); UserGroupInformation.getLoginUser());
Map<ApplicationAttemptId, ApplicationAttemptReport> appAttempts = Map<ApplicationAttemptId, ApplicationAttemptReport> appAttempts =
new HashMap<ApplicationAttemptId, ApplicationAttemptReport>(); new LinkedHashMap<ApplicationAttemptId, ApplicationAttemptReport>();
for (TimelineEntity entity : entities.getEntities()) { for (TimelineEntity entity : entities.getEntities()) {
ApplicationAttemptReport appAttempt = ApplicationAttemptReport appAttempt =
convertToApplicationAttemptReport(entity); convertToApplicationAttemptReport(entity);
@ -198,7 +199,7 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class), null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class),
UserGroupInformation.getLoginUser()); UserGroupInformation.getLoginUser());
Map<ContainerId, ContainerReport> containers = Map<ContainerId, ContainerReport> containers =
new HashMap<ContainerId, ContainerReport>(); new LinkedHashMap<ContainerId, ContainerReport>();
if (entities != null && entities.getEntities() != null) { if (entities != null && entities.getEntities() != null) {
for (TimelineEntity entity : entities.getEntities()) { for (TimelineEntity entity : entities.getEntities()) {
ContainerReport container = convertToContainerReport( ContainerReport container = convertToContainerReport(

View File

@ -168,7 +168,7 @@ public class TestApplicationHistoryClientService {
clientService.getContainers(request); clientService.getContainers(request);
List<ContainerReport> containers = response.getContainerList(); List<ContainerReport> containers = response.getContainerList();
Assert.assertNotNull(containers); Assert.assertNotNull(containers);
Assert.assertEquals(containerId, containers.get(1).getContainerId()); Assert.assertEquals(containerId, containers.get(0).getContainerId());
Assert.assertEquals(containerId1, containers.get(0).getContainerId()); Assert.assertEquals(containerId1, containers.get(1).getContainerId());
} }
} }