use of org.apache.hadoop.yarn.api.records.timeline.TimelineEntityGroupId in project tez by apache.
the class TestTimelineCachePluginImpl method testGetTimelineEntityGroupIdByIds.
@Test
public void testGetTimelineEntityGroupIdByIds() {
TimelineCachePluginImpl plugin = createPlugin(100, null);
for (Entry<String, String> entry : typeIdMap1.entrySet()) {
SortedSet<String> entityIds = new TreeSet<String>();
entityIds.add(entry.getValue());
entityIds.add(typeIdMap2.get(entry.getKey()));
Set<TimelineEntityGroupId> groupIds = plugin.getTimelineEntityGroupId(entry.getKey(), entityIds, null);
if (entry.getKey().equals(EntityTypes.TEZ_DAG_ID.name())) {
Assert.assertNull(groupIds);
continue;
}
Assert.assertEquals(4, groupIds.size());
int found = 0;
Iterator<TimelineEntityGroupId> iter = groupIds.iterator();
while (iter.hasNext()) {
TimelineEntityGroupId groupId = iter.next();
if (groupId.getApplicationId().equals(appId1)) {
String entityGroupId = groupId.getTimelineEntityGroupId();
if (getGroupIds(dagID1, 100).contains(entityGroupId)) {
++found;
} else {
Assert.fail("Unexpected group id: " + entityGroupId);
}
} else if (groupId.getApplicationId().equals(appId2)) {
String entityGroupId = groupId.getTimelineEntityGroupId();
if (getGroupIds(dagID2, 100).contains(entityGroupId)) {
++found;
} else {
Assert.fail("Unexpected group id: " + entityGroupId);
}
} else {
Assert.fail("Unexpected appId: " + groupId.getApplicationId());
}
}
Assert.assertEquals("All groupIds not returned", 4, found);
}
}
use of org.apache.hadoop.yarn.api.records.timeline.TimelineEntityGroupId in project tez by apache.
the class TestTimelineCachePluginImpl method testGetTimelineEntityGroupIdById.
@Test
public void testGetTimelineEntityGroupIdById() {
TimelineCachePluginImpl plugin = createPlugin(100, null);
for (Entry<String, String> entry : typeIdMap1.entrySet()) {
Set<TimelineEntityGroupId> groupIds = plugin.getTimelineEntityGroupId(entry.getValue(), entry.getKey());
if (entry.getKey().equals(EntityTypes.TEZ_DAG_ID.name())) {
Assert.assertNull(groupIds);
continue;
}
Assert.assertEquals(2, groupIds.size());
Iterator<TimelineEntityGroupId> iter = groupIds.iterator();
while (iter.hasNext()) {
TimelineEntityGroupId groupId = iter.next();
Assert.assertEquals(appId1, groupId.getApplicationId());
Assert.assertTrue(getGroupIds(dagID1, 100).contains(groupId.getTimelineEntityGroupId()));
}
}
}
use of org.apache.hadoop.yarn.api.records.timeline.TimelineEntityGroupId in project tez by apache.
the class TestTimelineCachePluginImpl method testGetTimelineEntityGroupIdByPrimaryFilter.
@Test
public void testGetTimelineEntityGroupIdByPrimaryFilter() {
TimelineCachePluginImpl plugin = createPlugin(100, null);
for (Entry<String, String> entry : typeIdMap1.entrySet()) {
NameValuePair primaryFilter = new NameValuePair(entry.getKey(), entry.getValue());
Assert.assertNull(plugin.getTimelineEntityGroupId(EntityTypes.TEZ_APPLICATION.name(), primaryFilter, null));
Set<TimelineEntityGroupId> groupIds = plugin.getTimelineEntityGroupId(entry.getKey(), primaryFilter, null);
if (entry.getKey().equals(EntityTypes.TEZ_DAG_ID.name())) {
Assert.assertNull(groupIds);
continue;
}
Assert.assertEquals(2, groupIds.size());
Iterator<TimelineEntityGroupId> iter = groupIds.iterator();
while (iter.hasNext()) {
TimelineEntityGroupId groupId = iter.next();
Assert.assertEquals(appId1, groupId.getApplicationId());
Assert.assertTrue(getGroupIds(dagID1, 100).contains(groupId.getTimelineEntityGroupId()));
}
}
}
use of org.apache.hadoop.yarn.api.records.timeline.TimelineEntityGroupId in project tez by apache.
the class TestTimelineCachePluginImpl method testGetTimelineEntityGroupIdByIdWithOldGroupIdsEmpty.
@Test
public void testGetTimelineEntityGroupIdByIdWithOldGroupIdsEmpty() {
TimelineCachePluginImpl plugin = createPlugin(100, "");
for (Entry<String, String> entry : typeIdMap2.entrySet()) {
Set<TimelineEntityGroupId> groupIds = plugin.getTimelineEntityGroupId(entry.getValue(), entry.getKey());
if (entry.getKey().equals(EntityTypes.TEZ_DAG_ID.name())) {
Assert.assertNull(groupIds);
continue;
}
Assert.assertEquals(2, groupIds.size());
Iterator<TimelineEntityGroupId> iter = groupIds.iterator();
while (iter.hasNext()) {
TimelineEntityGroupId groupId = iter.next();
Assert.assertEquals(appId2, groupId.getApplicationId());
Assert.assertTrue(getGroupIds(dagID2, 100).contains(groupId.getTimelineEntityGroupId()));
}
}
}
use of org.apache.hadoop.yarn.api.records.timeline.TimelineEntityGroupId in project tez by apache.
the class TestTimelineCachePluginImpl method testContainerIdConversion.
@Test
public void testContainerIdConversion() {
TimelineCachePluginImpl plugin = createPlugin(-1, null);
String entityType = EntityTypes.TEZ_CONTAINER_ID.name();
SortedSet<String> entityIds = new TreeSet<String>();
entityIds.add("tez_" + cId1.toString());
entityIds.add("tez_" + cId2.toString());
Set<TimelineEntityGroupId> groupIds = plugin.getTimelineEntityGroupId(entityType, entityIds, null);
Assert.assertEquals(2, groupIds.size());
int found = 0;
Iterator<TimelineEntityGroupId> iter = groupIds.iterator();
while (iter.hasNext()) {
TimelineEntityGroupId groupId = iter.next();
if (groupId.getApplicationId().equals(appId1) && groupId.getTimelineEntityGroupId().equals(appId1.toString())) {
++found;
} else if (groupId.getApplicationId().equals(appId2) && groupId.getTimelineEntityGroupId().equals(appId2.toString())) {
++found;
}
}
Assert.assertEquals("All groupIds not returned", 2, found);
groupIds.clear();
groupIds = plugin.getTimelineEntityGroupId(cId1.toString(), entityType);
Assert.assertEquals(1, groupIds.size());
found = 0;
iter = groupIds.iterator();
while (iter.hasNext()) {
TimelineEntityGroupId groupId = iter.next();
if (groupId.getApplicationId().equals(appId1) && groupId.getTimelineEntityGroupId().equals(appId1.toString())) {
++found;
}
}
Assert.assertEquals("All groupIds not returned", 1, found);
groupIds.clear();
groupIds = plugin.getTimelineEntityGroupId("tez_" + cId2.toString(), entityType);
Assert.assertEquals(1, groupIds.size());
found = 0;
iter = groupIds.iterator();
while (iter.hasNext()) {
TimelineEntityGroupId groupId = iter.next();
if (groupId.getApplicationId().equals(appId2) && groupId.getTimelineEntityGroupId().equals(appId2.toString())) {
++found;
}
}
Assert.assertEquals("All groupIds not returned", 1, found);
}
Aggregations