YARN-8063. DistributedShellTimelinePlugin wrongly check for entityId instead of entityType. Contributed by Rohith Sharma K S.

This commit is contained in:
Sunil G 2018-03-23 10:54:00 +05:30
parent 8620d2bdf9
commit 22c5ddb7c4
2 changed files with 10 additions and 1 deletions

View File

@ -52,7 +52,7 @@ public Set<TimelineEntityGroupId> getTimelineEntityGroupId(String entityType,
@Override @Override
public Set<TimelineEntityGroupId> getTimelineEntityGroupId(String entityId, public Set<TimelineEntityGroupId> getTimelineEntityGroupId(String entityId,
String entityType) { String entityType) {
if (ApplicationMaster.DSEntity.DS_CONTAINER.toString().equals(entityId)) { if (ApplicationMaster.DSEntity.DS_CONTAINER.toString().equals(entityType)) {
ContainerId containerId = ContainerId.fromString(entityId); ContainerId containerId = ContainerId.fromString(entityId);
ApplicationId appId = containerId.getApplicationAttemptId() ApplicationId appId = containerId.getApplicationAttemptId()
.getApplicationId(); .getApplicationId();

View File

@ -494,6 +494,15 @@ private void checkTimelineV1(boolean haveDomain) throws Exception {
Assert.assertEquals(2, entities.getEntities().size()); Assert.assertEquals(2, entities.getEntities().size());
Assert.assertEquals(entities.getEntities().get(0).getEntityType() Assert.assertEquals(entities.getEntities().get(0).getEntityType()
.toString(), ApplicationMaster.DSEntity.DS_CONTAINER.toString()); .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) { if (haveDomain) {
Assert.assertEquals(domain.getId(), Assert.assertEquals(domain.getId(),
entities.getEntities().get(0).getDomainId()); entities.getEntities().get(0).getDomainId());