Search in sources :

Example 1 with TimelineDomain

use of org.apache.hadoop.yarn.api.records.timeline.TimelineDomain in project hadoop by apache.

the class TimelineDataManager method serviceInit.

@Override
protected void serviceInit(Configuration conf) throws Exception {
    metrics = TimelineDataManagerMetrics.create();
    TimelineDomain domain = store.getDomain("DEFAULT");
    // 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);
}
Also used : TimelineDomain(org.apache.hadoop.yarn.api.records.timeline.TimelineDomain)

Example 2 with TimelineDomain

use of org.apache.hadoop.yarn.api.records.timeline.TimelineDomain in project hadoop by apache.

the class TimelineStoreTestUtils method testGetDomain.

public void testGetDomain() throws IOException {
    TimelineDomain actualDomain1 = store.getDomain(domain1.getId());
    verifyDomainInfo(domain1, actualDomain1);
    assertTrue(actualDomain1.getCreatedTime() > 0);
    assertTrue(actualDomain1.getModifiedTime() > 0);
    assertEquals(actualDomain1.getCreatedTime(), actualDomain1.getModifiedTime());
    TimelineDomain actualDomain2 = store.getDomain(domain2.getId());
    verifyDomainInfo(domain2, actualDomain2);
    assertEquals("domain_id_2", actualDomain2.getId());
    assertTrue(actualDomain2.getCreatedTime() > 0);
    assertTrue(actualDomain2.getModifiedTime() > 0);
    assertTrue(actualDomain2.getCreatedTime() < actualDomain2.getModifiedTime());
}
Also used : TimelineDomain(org.apache.hadoop.yarn.api.records.timeline.TimelineDomain)

Example 3 with TimelineDomain

use of org.apache.hadoop.yarn.api.records.timeline.TimelineDomain in project hadoop by apache.

the class TestTimelineClient method generateDomain.

public static TimelineDomain generateDomain() {
    TimelineDomain domain = new TimelineDomain();
    domain.setId("namesapce id");
    domain.setDescription("domain description");
    domain.setOwner("domain owner");
    domain.setReaders("domain_reader");
    domain.setWriters("domain_writer");
    domain.setCreatedTime(0L);
    domain.setModifiedTime(1L);
    return domain;
}
Also used : TimelineDomain(org.apache.hadoop.yarn.api.records.timeline.TimelineDomain)

Example 4 with TimelineDomain

use of org.apache.hadoop.yarn.api.records.timeline.TimelineDomain in project hadoop by apache.

the class TestTimelineClientForATS1_5 method generateDomain.

private static TimelineDomain generateDomain() {
    TimelineDomain domain = new TimelineDomain();
    domain.setId("namesapce id");
    domain.setDescription("domain description");
    domain.setOwner("domain owner");
    domain.setReaders("domain_reader");
    domain.setWriters("domain_writer");
    domain.setCreatedTime(0L);
    domain.setModifiedTime(1L);
    return domain;
}
Also used : TimelineDomain(org.apache.hadoop.yarn.api.records.timeline.TimelineDomain)

Example 5 with TimelineDomain

use of org.apache.hadoop.yarn.api.records.timeline.TimelineDomain in project hadoop by apache.

the class KeyValueBasedTimelineStore method getDomains.

@Override
public TimelineDomains getDomains(String owner) throws IOException {
    if (getServiceStopped()) {
        LOG.info("Service stopped, return null for the storage");
        return null;
    }
    List<TimelineDomain> domains = new ArrayList<TimelineDomain>();
    Set<TimelineDomain> domainsOfOneOwner = domainsByOwner.get(owner);
    if (domainsOfOneOwner == null) {
        return new TimelineDomains();
    }
    for (TimelineDomain domain : domainsByOwner.get(owner)) {
        TimelineDomain domainToReturn = KeyValueBasedTimelineStoreUtils.createTimelineDomain(domain.getId(), domain.getDescription(), domain.getOwner(), domain.getReaders(), domain.getWriters(), domain.getCreatedTime(), domain.getModifiedTime());
        domains.add(domainToReturn);
    }
    Collections.sort(domains, new Comparator<TimelineDomain>() {

        @Override
        public int compare(TimelineDomain domain1, TimelineDomain domain2) {
            int result = domain2.getCreatedTime().compareTo(domain1.getCreatedTime());
            if (result == 0) {
                return domain2.getModifiedTime().compareTo(domain1.getModifiedTime());
            } else {
                return result;
            }
        }
    });
    TimelineDomains domainsToReturn = new TimelineDomains();
    domainsToReturn.addDomains(domains);
    return domainsToReturn;
}
Also used : TimelineDomains(org.apache.hadoop.yarn.api.records.timeline.TimelineDomains) ArrayList(java.util.ArrayList) TimelineDomain(org.apache.hadoop.yarn.api.records.timeline.TimelineDomain)

Aggregations

TimelineDomain (org.apache.hadoop.yarn.api.records.timeline.TimelineDomain)28 Test (org.junit.Test)9 IOException (java.io.IOException)7 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)7 Configuration (org.apache.hadoop.conf.Configuration)5 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)5 ClientResponse (com.sun.jersey.api.client.ClientResponse)4 WebResource (com.sun.jersey.api.client.WebResource)4 TimelineEntities (org.apache.hadoop.yarn.api.records.timeline.TimelineEntities)4 Path (org.apache.hadoop.fs.Path)3 TimelineDomains (org.apache.hadoop.yarn.api.records.timeline.TimelineDomains)3 TimelineClient (org.apache.hadoop.yarn.client.api.TimelineClient)3 ArrayList (java.util.ArrayList)2 ParseException (org.apache.commons.cli.ParseException)2 HdfsConfiguration (org.apache.hadoop.hdfs.HdfsConfiguration)2 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)2 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)2 AdminACLsManager (org.apache.hadoop.yarn.security.AdminACLsManager)2 JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 File (java.io.File)1