From 2f6d6cc0d6ad31cfa8abb0657bab2cf6fb539216 Mon Sep 17 00:00:00 2001 From: Sunil G Date: Fri, 23 Mar 2018 10:54:00 +0530 Subject: [PATCH] YARN-8063. DistributedShellTimelinePlugin wrongly check for entityId instead of entityType. Contributed by Rohith Sharma K S. (cherry picked from commit 22c5ddb7c4fb48d5bf5a7456d0b1b27d48c2a485) --- .../distributedshell/DistributedShellTimelinePlugin.java | 2 +- .../distributedshell/TestDistributedShell.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/DistributedShellTimelinePlugin.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/DistributedShellTimelinePlugin.java index 119fa6f3bd5..cf5bc839da1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/DistributedShellTimelinePlugin.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/DistributedShellTimelinePlugin.java @@ -52,7 +52,7 @@ public class DistributedShellTimelinePlugin extends TimelineEntityGroupPlugin { @Override public Set getTimelineEntityGroupId(String entityId, String entityType) { - if (ApplicationMaster.DSEntity.DS_CONTAINER.toString().equals(entityId)) { + if (ApplicationMaster.DSEntity.DS_CONTAINER.toString().equals(entityType)) { ContainerId containerId = ContainerId.fromString(entityId); ApplicationId appId = containerId.getApplicationAttemptId() .getApplicationId(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java index b30a464e924..d0e3fc7b308 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java @@ -486,6 +486,15 @@ public class TestDistributedShell { Assert.assertEquals(2, entities.getEntities().size()); Assert.assertEquals(entities.getEntities().get(0).getEntityType() .toString(), ApplicationMaster.DSEntity.DS_CONTAINER.toString()); + + String entityId = entities.getEntities().get(0).getEntityId(); + org.apache.hadoop.yarn.api.records.timeline.TimelineEntity entity = + yarnCluster.getApplicationHistoryServer().getTimelineStore() + .getEntity(entityId, + ApplicationMaster.DSEntity.DS_CONTAINER.toString(), null); + Assert.assertNotNull(entity); + Assert.assertEquals(entityId, entity.getEntityId()); + if (haveDomain) { Assert.assertEquals(domain.getId(), entities.getEntities().get(0).getDomainId());