private ApplicationReportExt getApplication(ApplicationId appId, ApplicationReportField field) throws YarnException, IOException { TimelineEntity entity = timelineDataManager.getEntity( ApplicationMetricsConstants.ENTITY_TYPE, appId.toString(), EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); if (entity == null) { throw new ApplicationNotFoundException("The entity for application " + appId + " doesn't exist in the timeline store"); } else { return generateApplicationReport(entity, field); } }
private ApplicationReportExt getApplication(ApplicationId appId, ApplicationReportField field) throws YarnException, IOException { TimelineEntity entity = timelineDataManager.getEntity( ApplicationMetricsConstants.ENTITY_TYPE, appId.toString(), EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); if (entity == null) { throw new ApplicationNotFoundException("The entity for application " + appId + " doesn't exist in the timeline store"); } else { return generateApplicationReport(entity, field); } }
private ApplicationReportExt getApplication(ApplicationId appId, ApplicationReportField field) throws YarnException, IOException { TimelineEntity entity = timelineDataManager.getEntity( ApplicationMetricsConstants.ENTITY_TYPE, appId.toString(), EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); if (entity == null) { throw new ApplicationNotFoundException("The entity for application " + appId + " doesn't exist in the timeline store"); } else { return generateApplicationReport(entity, field); } }
TimelineEntity entity = null; try { entity = timelineDataManager.getEntity( parseStr(entityType), parseStr(entityId),
TimelineEntity entity = null; try { entity = timelineDataManager.getEntity( parseStr(entityType), parseStr(entityId),
TimelineEntity entity = null; try { entity = timelineDataManager.getEntity( parseStr(entityType), parseStr(entityId),
private ApplicationAttemptReport getApplicationAttempt( ApplicationAttemptId appAttemptId, boolean checkACLs) throws YarnException, IOException { if (checkACLs) { ApplicationReportExt app = getApplication( appAttemptId.getApplicationId(), ApplicationReportField.USER_AND_ACLS); checkAccess(app); } TimelineEntity entity = timelineDataManager.getEntity( AppAttemptMetricsConstants.ENTITY_TYPE, appAttemptId.toString(), EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); if (entity == null) { throw new ApplicationAttemptNotFoundException( "The entity for application attempt " + appAttemptId + " doesn't exist in the timeline store"); } else { return convertToApplicationAttemptReport(entity); } }
private ApplicationAttemptReport getApplicationAttempt( ApplicationAttemptId appAttemptId, boolean checkACLs) throws YarnException, IOException { if (checkACLs) { ApplicationReportExt app = getApplication( appAttemptId.getApplicationId(), ApplicationReportField.USER_AND_ACLS); checkAccess(app); } TimelineEntity entity = timelineDataManager.getEntity( AppAttemptMetricsConstants.ENTITY_TYPE, appAttemptId.toString(), EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); if (entity == null) { throw new ApplicationAttemptNotFoundException( "The entity for application attempt " + appAttemptId + " doesn't exist in the timeline store"); } else { return convertToApplicationAttemptReport(entity); } }
private ApplicationAttemptReport getApplicationAttempt( ApplicationAttemptId appAttemptId, boolean checkACLs) throws YarnException, IOException { if (checkACLs) { ApplicationReportExt app = getApplication( appAttemptId.getApplicationId(), ApplicationReportField.USER_AND_ACLS); checkAccess(app); } TimelineEntity entity = timelineDataManager.getEntity( AppAttemptMetricsConstants.ENTITY_TYPE, appAttemptId.toString(), EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); if (entity == null) { throw new ApplicationAttemptNotFoundException( "The entity for application attempt " + appAttemptId + " doesn't exist in the timeline store"); } else { return convertToApplicationAttemptReport(entity); } }
static void verifyTestEntities(TimelineDataManager tdm) throws YarnException, IOException { TimelineEntity entity1 = tdm.getEntity("type_1", "id_1", EnumSet.allOf(TimelineReader.Field.class), UserGroupInformation.getLoginUser()); TimelineEntity entity2 = tdm.getEntity("type_2", "id_2", EnumSet.allOf(TimelineReader.Field.class), UserGroupInformation.getLoginUser()); assertNotNull(entity1); assertNotNull(entity2); assertEquals("Failed to read out entity 1", (Long) 123l, entity1.getStartTime()); assertEquals("Failed to read out entity 2", (Long) 456l, entity2.getStartTime()); }
@Override public ContainerReport getContainer(ContainerId containerId) throws YarnException, IOException { ApplicationReportExt app = getApplication( containerId.getApplicationAttemptId().getApplicationId(), ApplicationReportField.USER_AND_ACLS); checkAccess(app); TimelineEntity entity = timelineDataManager.getEntity( ContainerMetricsConstants.ENTITY_TYPE, containerId.toString(), EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); if (entity == null) { throw new ContainerNotFoundException( "The entity for container " + containerId + " doesn't exist in the timeline store"); } else { return convertToContainerReport( entity, serverHttpAddress, app.appReport.getUser()); } }
@Override public ContainerReport getContainer(ContainerId containerId) throws YarnException, IOException { ApplicationReportExt app = getApplication( containerId.getApplicationAttemptId().getApplicationId(), ApplicationReportField.USER_AND_ACLS); checkAccess(app); TimelineEntity entity = timelineDataManager.getEntity( ContainerMetricsConstants.ENTITY_TYPE, containerId.toString(), EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); if (entity == null) { throw new ContainerNotFoundException( "The entity for container " + containerId + " doesn't exist in the timeline store"); } else { return convertToContainerReport( entity, serverHttpAddress, app.appReport.getUser()); } }
@Override public ContainerReport getContainer(ContainerId containerId) throws YarnException, IOException { ApplicationReportExt app = getApplication( containerId.getApplicationAttemptId().getApplicationId(), ApplicationReportField.USER_AND_ACLS); checkAccess(app); TimelineEntity entity = timelineDataManager.getEntity( ContainerMetricsConstants.ENTITY_TYPE, containerId.toString(), EnumSet.allOf(Field.class), UserGroupInformation.getLoginUser()); if (entity == null) { throw new ContainerNotFoundException( "The entity for container " + containerId + " doesn't exist in the timeline store"); } else { return convertToContainerReport( entity, serverHttpAddress, app.appReport.getUser()); } }
@Test public void testGetOldEntityWithOutDomainId() throws Exception { TimelineEntity entity = dataManaer.getEntity( "OLD_ENTITY_TYPE_1", "OLD_ENTITY_ID_1", null, UserGroupInformation.getCurrentUser()); Assert.assertNotNull(entity); Assert.assertEquals("OLD_ENTITY_ID_1", entity.getEntityId()); Assert.assertEquals("OLD_ENTITY_TYPE_1", entity.getEntityType()); Assert.assertEquals( TimelineDataManager.DEFAULT_DOMAIN_ID, entity.getDomainId()); }
TimelineEntity entity3 = tdm.getEntity("type_3", mainTestAppId.toString(), EnumSet.allOf(TimelineReader.Field.class), UserGroupInformation.getLoginUser());
@Test public void testParseEntity() throws Exception { // Load test data TimelineDataManager tdm = PluginStoreTestUtils.getTdmWithMemStore(config); EntityLogInfo testLogInfo = new EntityLogInfo(TEST_ATTEMPT_DIR_NAME, TEST_ENTITY_FILE_NAME, UserGroupInformation.getLoginUser().getUserName()); testLogInfo.parseForStore(tdm, getTestRootPath(), true, jsonFactory, objMapper, fs); // Verify for the first batch PluginStoreTestUtils.verifyTestEntities(tdm); // Load new data TimelineEntity entityNew = PluginStoreTestUtils .createEntity("id_3", "type_3", 789l, null, null, null, null, "domain_id_1"); TimelineEntities entityList = new TimelineEntities(); entityList.addEntity(entityNew); writeEntitiesLeaveOpen(entityList, new Path(getTestRootPath(TEST_ATTEMPT_DIR_NAME), TEST_ENTITY_FILE_NAME)); testLogInfo.parseForStore(tdm, getTestRootPath(), true, jsonFactory, objMapper, fs); // Verify the newly added data TimelineEntity entity3 = tdm.getEntity(entityNew.getEntityType(), entityNew.getEntityId(), EnumSet.allOf(TimelineReader.Field.class), UserGroupInformation.getLoginUser()); assertNotNull(entity3); assertEquals("Failed to read out entity new", entityNew.getStartTime(), entity3.getStartTime()); tdm.close(); }