@Override public void put(TimelineDomain domain) throws IOException { summaryStore.put(domain); } }
@Override public TimelinePutResponse put(TimelineEntities data) throws IOException { return summaryStore.put(data); }
@Override public TimelinePutResponse put(TimelineEntities data) throws IOException { return summaryStore.put(data); }
@Override public TimelinePutResponse put(TimelineEntities data) throws IOException { return summaryStore.put(data); }
@Override public void put(TimelineDomain domain) throws IOException { summaryStore.put(domain); } }
@Override public void put(TimelineDomain domain) throws IOException { summaryStore.put(domain); }
@Override protected void serviceInit(Configuration conf) throws Exception { TimelineDomain domain = store.getDomain("DEFAULT"); // it is okay to reuse an existing domain even if it was created by another // user of the timeline server before, because it allows everybody to access. if (domain == null) { // create a default domain, which allows everybody to access and modify // the entities in it. domain = new TimelineDomain(); domain.setId(DEFAULT_DOMAIN_ID); domain.setDescription("System Default Domain"); domain.setOwner( UserGroupInformation.getCurrentUser().getShortUserName()); domain.setReaders("*"); domain.setWriters("*"); store.put(domain); } super.serviceInit(conf); }
@Override protected void serviceInit(Configuration conf) throws Exception { TimelineDomain domain = store.getDomain("DEFAULT"); // it is okay to reuse an existing domain even if it was created by another // user of the timeline server before, because it allows everybody to access. if (domain == null) { // create a default domain, which allows everybody to access and modify // the entities in it. domain = new TimelineDomain(); domain.setId(DEFAULT_DOMAIN_ID); domain.setDescription("System Default Domain"); domain.setOwner( UserGroupInformation.getCurrentUser().getShortUserName()); domain.setReaders("*"); domain.setWriters("*"); store.put(domain); } super.serviceInit(conf); }
@Override protected void serviceInit(Configuration conf) throws Exception { metrics = TimelineDataManagerMetrics.create(); TimelineDomain domain = store.getDomain("DEFAULT"); // it is okay to reuse an existing domain even if it was created by another // user of the timeline server before, because it allows everybody to access. if (domain == null) { // create a default domain, which allows everybody to access and modify // the entities in it. domain = new TimelineDomain(); domain.setId(DEFAULT_DOMAIN_ID); domain.setDescription("System Default Domain"); domain.setOwner( UserGroupInformation.getCurrentUser().getShortUserName()); domain.setReaders("*"); domain.setWriters("*"); store.put(domain); } super.serviceInit(conf); }
private void doPutDomain(TimelineDomain domain, UserGroupInformation callerUGI) throws YarnException, IOException { TimelineDomain existingDomain = store.getDomain(domain.getId()); if (existingDomain != null) { if (!timelineACLsManager.checkAccess(callerUGI, existingDomain)) { throw new YarnException(callerUGI.getShortUserName() + " is not allowed to override an existing domain " + existingDomain.getId()); } // Set it again in case ACLs are not enabled: The domain can be // modified by every body, but the owner is not changed. domain.setOwner(existingDomain.getOwner()); } store.put(domain); // If the domain exists already, it is likely to be in the cache. // We need to invalidate it. if (existingDomain != null) { timelineACLsManager.replaceIfExist(domain); } }
/** * Add or update an domain. If the domain already exists, only the owner * and the admin can update it. */ public void putDomain(TimelineDomain domain, UserGroupInformation callerUGI) throws YarnException, IOException { TimelineDomain existingDomain = store.getDomain(domain.getId()); if (existingDomain != null) { if (!timelineACLsManager.checkAccess(callerUGI, existingDomain)) { throw new YarnException(callerUGI.getShortUserName() + " is not allowed to override an existing domain " + existingDomain.getId()); } // Set it again in case ACLs are not enabled: The domain can be // modified by every body, but the owner is not changed. domain.setOwner(existingDomain.getOwner()); } store.put(domain); // If the domain exists already, it is likely to be in the cache. // We need to invalidate it. if (existingDomain != null) { timelineACLsManager.replaceIfExist(domain); } }
/** * Add or update an domain. If the domain already exists, only the owner * and the admin can update it. */ public void putDomain(TimelineDomain domain, UserGroupInformation callerUGI) throws YarnException, IOException { TimelineDomain existingDomain = store.getDomain(domain.getId()); if (existingDomain != null) { if (!timelineACLsManager.checkAccess(callerUGI, existingDomain)) { throw new YarnException(callerUGI.getShortUserName() + " is not allowed to override an existing domain " + existingDomain.getId()); } // Set it again in case ACLs are not enabled: The domain can be // modified by every body, but the owner is not changed. domain.setOwner(existingDomain.getOwner()); } store.put(domain); // If the domain exists already, it is likely to be in the cache. // We need to invalidate it. if (existingDomain != null) { timelineACLsManager.replaceIfExist(domain); } }
@Test public void testRelatingToNonExistingEntity() throws IOException { TimelineEntity entityToStore = new TimelineEntity(); entityToStore.setEntityType("TEST_ENTITY_TYPE_1"); entityToStore.setEntityId("TEST_ENTITY_ID_1"); entityToStore.setDomainId(TimelineDataManager.DEFAULT_DOMAIN_ID); entityToStore.addRelatedEntity("TEST_ENTITY_TYPE_2", "TEST_ENTITY_ID_2"); TimelineEntities entities = new TimelineEntities(); entities.addEntity(entityToStore); store.put(entities); TimelineEntity entityToGet = store.getEntity("TEST_ENTITY_ID_2", "TEST_ENTITY_TYPE_2", null); Assert.assertNotNull(entityToGet); Assert.assertEquals("DEFAULT", entityToGet.getDomainId()); Assert.assertEquals("TEST_ENTITY_TYPE_1", entityToGet.getRelatedEntities().keySet().iterator().next()); Assert.assertEquals("TEST_ENTITY_ID_1", entityToGet.getRelatedEntities().values().iterator().next() .iterator().next()); }
@Test public void testRelatingToNonExistingEntity() throws IOException { TimelineEntity entityToStore = new TimelineEntity(); entityToStore.setEntityType("TEST_ENTITY_TYPE_1"); entityToStore.setEntityId("TEST_ENTITY_ID_1"); entityToStore.setDomainId(TimelineDataManager.DEFAULT_DOMAIN_ID); entityToStore.addRelatedEntity("TEST_ENTITY_TYPE_2", "TEST_ENTITY_ID_2"); TimelineEntities entities = new TimelineEntities(); entities.addEntity(entityToStore); store.put(entities); TimelineEntity entityToGet = store.getEntity("TEST_ENTITY_ID_2", "TEST_ENTITY_TYPE_2", null); Assert.assertNotNull(entityToGet); Assert.assertEquals("DEFAULT", entityToGet.getDomainId()); Assert.assertEquals("TEST_ENTITY_TYPE_1", entityToGet.getRelatedEntities().keySet().iterator().next()); Assert.assertEquals("TEST_ENTITY_ID_1", entityToGet.getRelatedEntities().values().iterator().next() .iterator().next()); }
entityType1, 789l, Collections.singletonList(ev2), null, primaryFilter, null, domainId1))); TimelinePutResponse response = store.put(atsEntities); assertEquals(0, response.getErrors().size());
@Test public void testRelatingToEntityInSamePut() throws IOException { TimelineEntity entityToRelate = new TimelineEntity(); entityToRelate.setEntityType("TEST_ENTITY_TYPE_2"); entityToRelate.setEntityId("TEST_ENTITY_ID_2"); entityToRelate.setDomainId("TEST_DOMAIN"); TimelineEntity entityToStore = new TimelineEntity(); entityToStore.setEntityType("TEST_ENTITY_TYPE_1"); entityToStore.setEntityId("TEST_ENTITY_ID_1"); entityToStore.setDomainId("TEST_DOMAIN"); entityToStore.addRelatedEntity("TEST_ENTITY_TYPE_2", "TEST_ENTITY_ID_2"); TimelineEntities entities = new TimelineEntities(); entities.addEntity(entityToStore); entities.addEntity(entityToRelate); store.put(entities); TimelineEntity entityToGet = store.getEntity("TEST_ENTITY_ID_2", "TEST_ENTITY_TYPE_2", null); Assert.assertNotNull(entityToGet); Assert.assertEquals("TEST_DOMAIN", entityToGet.getDomainId()); Assert.assertEquals("TEST_ENTITY_TYPE_1", entityToGet.getRelatedEntities().keySet().iterator().next()); Assert.assertEquals("TEST_ENTITY_ID_1", entityToGet.getRelatedEntities().values().iterator().next() .iterator().next()); }
TimelineEntities entities = new TimelineEntities(); entities.addEntity(entityToStore); store.put(entities); entities = new TimelineEntities(); entities.addEntity(entityToStore); TimelinePutResponse response = store.put(entities); Assert.assertEquals(1, response.getErrors().size()); Assert.assertEquals(TimelinePutError.FORBIDDEN_RELATION,
TimelineEntities entities = new TimelineEntities(); entities.addEntity(entityToStore); store.put(entities); entities = new TimelineEntities(); entities.addEntity(entityToStore); TimelinePutResponse response = store.put(entities); Assert.assertEquals(1, response.getErrors().size()); Assert.assertEquals(TimelinePutError.FORBIDDEN_RELATION,
domain1.setReaders("reader_user_1 reader_group_1"); domain1.setWriters("writer_user_1 writer_group_1"); store.put(domain1); domain2.setReaders("reader_user_2 reader_group_2"); domain2.setWriters("writer_user_2 writer_group_2"); store.put(domain2); domain2.setReaders("reader_user_3 reader_group_3"); domain2.setWriters("writer_user_3 writer_group_3"); store.put(domain2); domain3.setReaders("reader_user_4 reader_group_4"); domain3.setWriters("writer_user_4 writer_group_4"); store.put(domain3);
@BeforeClass public static void prepareStore() throws Exception { store = createStore(SCALE); TimelineEntities entities = new TimelineEntities(); entities.addEntity(createApplicationTimelineEntity( ApplicationId.newInstance(0, SCALE + 1), true, true, false, false, YarnApplicationState.FINISHED)); entities.addEntity(createApplicationTimelineEntity( ApplicationId.newInstance(0, SCALE + 2), true, false, true, false, YarnApplicationState.FINISHED)); store.put(entities); }