• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TimelineDomain类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.yarn.api.records.timeline.TimelineDomain的典型用法代码示例。如果您正苦于以下问题:Java TimelineDomain类的具体用法?Java TimelineDomain怎么用?Java TimelineDomain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TimelineDomain类属于org.apache.hadoop.yarn.api.records.timeline包,在下文中一共展示了TimelineDomain类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkAccess

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
public boolean checkAccess(UserGroupInformation callerUGI,
    TimelineDomain domain) throws YarnException, IOException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Verifying the access of "
        + (callerUGI == null ? null : callerUGI.getShortUserName())
        + " on the timeline domain " + domain);
  }

  if (!adminAclsManager.areACLsEnabled()) {
    return true;
  }

  String owner = domain.getOwner();
  if (owner == null || owner.length() == 0) {
    throw new YarnException("Owner information of the timeline domain "
        + domain.getId() + " is corrupted.");
  }
  if (callerUGI != null
      && (adminAclsManager.isAdmin(callerUGI) ||
          callerUGI.getShortUserName().equals(owner))) {
    return true;
  }
  return false;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TimelineACLsManager.java


示例2: getDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
@Override
public TimelineDomain getDomain(String domainId)
    throws IOException {
  TimelineDomain domain = domainsById.get(domainId);
  if (domain == null) {
    return null;
  } else {
    return createTimelineDomain(
        domain.getId(),
        domain.getDescription(),
        domain.getOwner(),
        domain.getReaders(),
        domain.getWriters(),
        domain.getCreatedTime(),
        domain.getModifiedTime());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:MemoryTimelineStore.java


示例3: put

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
public void put(TimelineDomain domain) throws IOException {
  TimelineDomain domainToReplace =
      domainsById.get(domain.getId());
  Long currentTimestamp = System.currentTimeMillis();
  TimelineDomain domainToStore = createTimelineDomain(
      domain.getId(), domain.getDescription(), domain.getOwner(),
      domain.getReaders(), domain.getWriters(),
      (domainToReplace == null ?
          currentTimestamp : domainToReplace.getCreatedTime()),
      currentTimestamp);
  domainsById.put(domainToStore.getId(), domainToStore);
  Set<TimelineDomain> domainsByOneOwner =
      domainsByOwner.get(domainToStore.getOwner());
  if (domainsByOneOwner == null) {
    domainsByOneOwner = new HashSet<TimelineDomain>();
    domainsByOwner.put(domainToStore.getOwner(), domainsByOneOwner);
  }
  if (domainToReplace != null) {
    domainsByOneOwner.remove(domainToReplace);
  }
  domainsByOneOwner.add(domainToStore);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:MemoryTimelineStore.java


示例4: putDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
/**
 * 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);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TimelineDataManager.java


示例5: testPutDomains

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
@Test
public void testPutDomains() throws Exception {
  KerberosTestUtils.doAs(HTTP_USER + "/localhost", new Callable<Void>() {
    @Override
    public Void call() throws Exception {
      TimelineClient client = createTimelineClientForUGI();
      TimelineDomain domainToStore = new TimelineDomain();
      domainToStore.setId(TestTimelineAuthenticationFilter.class.getName());
      domainToStore.setReaders("*");
      domainToStore.setWriters("*");
      client.putDomain(domainToStore);
      TimelineDomain domainToRead =
          testTimelineServer.getTimelineStore().getDomain(
              TestTimelineAuthenticationFilter.class.getName());
      Assert.assertNotNull(domainToRead);
      return null;
    }
  });
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestTimelineAuthenticationFilter.java


示例6: testYarnACLsEnabledForDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
@Test
public void testYarnACLsEnabledForDomain() throws Exception {
  Configuration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
  TimelineACLsManager timelineACLsManager =
      new TimelineACLsManager(conf);
  TimelineDomain domain = new TimelineDomain();
  domain.setOwner("owner");
  Assert.assertTrue(
      "Owner should be allowed to access",
      timelineACLsManager.checkAccess(
          UserGroupInformation.createRemoteUser("owner"), domain));
  Assert.assertFalse(
      "Other shouldn't be allowed to access",
      timelineACLsManager.checkAccess(
          UserGroupInformation.createRemoteUser("other"), domain));
  Assert.assertTrue(
      "Admin should be allowed to access",
      timelineACLsManager.checkAccess(
          UserGroupInformation.createRemoteUser("admin"), domain));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestTimelineACLsManager.java


示例7: testCorruptedOwnerInfoForDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
@Test
public void testCorruptedOwnerInfoForDomain() throws Exception {
  Configuration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, "owner");
  TimelineACLsManager timelineACLsManager =
      new TimelineACLsManager(conf);
  TimelineDomain domain = new TimelineDomain();
  try {
    timelineACLsManager.checkAccess(
        UserGroupInformation.createRemoteUser("owner"), domain);
    Assert.fail("Exception is expected");
  } catch (YarnException e) {
    Assert.assertTrue("It's not the exact expected exception", e.getMessage()
        .contains("is corrupted."));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestTimelineACLsManager.java


示例8: testGetDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
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());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TimelineStoreTestUtils.java


示例9: writeDomainLog

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
public void writeDomainLog(FileSystem fs, Path logPath,
    ObjectMapper objMapper, TimelineDomain domain,
    boolean isAppendSupported) throws IOException {
  try {
    this.domainFDLocker.lock();
    if (this.domainLogFD != null) {
      this.domainLogFD.writeDomain(domain);
    } else {
      this.domainLogFD =
          new DomainLogFD(fs, logPath, objMapper, isAppendSupported);
      this.domainLogFD.writeDomain(domain);
    }
  } finally {
    this.domainFDLocker.unlock();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:17,代码来源:FileSystemTimelineWriter.java


示例10: testPutDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
@Test
public void testPutDomain() {
  ApplicationId appId =
      ApplicationId.newInstance(System.currentTimeMillis(), 1);
  ApplicationAttemptId attemptId1 =
      ApplicationAttemptId.newInstance(appId, 1);
  try {
    TimelineDomain domain = generateDomain();

    client.putDomain(null, domain);
    verify(spyTimelineWriter, times(1)).putDomain(domain);
    reset(spyTimelineWriter);

    client.putDomain(attemptId1, domain);
    verify(spyTimelineWriter, times(0)).putDomain(domain);
    Assert.assertTrue(localFS.util().exists(
      new Path(getAppAttemptDir(attemptId1), "domainlog-"
          + attemptId1.toString())));
    reset(spyTimelineWriter);
  } catch (Exception e) {
    Assert.fail("Exception is not expected." + e);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:TestTimelineClientForATS1_5.java


示例11: doPutDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
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);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:TimelineDataManager.java


示例12: put

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
public void put(TimelineDomain domain) throws IOException {
  TimelineDomain domainToReplace =
      domainsById.get(domain.getId());
  long currentTimestamp = System.currentTimeMillis();
  TimelineDomain domainToStore = createTimelineDomain(
      domain.getId(), domain.getDescription(), domain.getOwner(),
      domain.getReaders(), domain.getWriters(),
      (domainToReplace == null ?
          currentTimestamp : domainToReplace.getCreatedTime()),
      currentTimestamp);
  domainsById.put(domainToStore.getId(), domainToStore);
  Set<TimelineDomain> domainsByOneOwner =
      domainsByOwner.get(domainToStore.getOwner());
  if (domainsByOneOwner == null) {
    domainsByOneOwner = new HashSet<TimelineDomain>();
    domainsByOwner.put(domainToStore.getOwner(), domainsByOneOwner);
  }
  if (domainToReplace != null) {
    domainsByOneOwner.remove(domainToReplace);
  }
  domainsByOneOwner.add(domainToStore);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:23,代码来源:MemoryTimelineStore.java


示例13: testPutDomains

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
@Test
public void testPutDomains() throws Exception {
  KerberosTestUtils.doAs(HTTP_USER + "/localhost", new Callable<Void>() {
    @Override
    public Void call() throws Exception {
      TimelineDomain domainToStore = new TimelineDomain();
      domainToStore.setId(TestTimelineAuthenticationFilter.class.getName());
      domainToStore.setReaders("*");
      domainToStore.setWriters("*");
      client.putDomain(domainToStore);
      TimelineDomain domainToRead =
          testTimelineServer.getTimelineStore().getDomain(
              TestTimelineAuthenticationFilter.class.getName());
      Assert.assertNotNull(domainToRead);
      return null;
    }
  });
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:19,代码来源:TestTimelineAuthenticationFilter.java


示例14: writeDomainLog

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
public void writeDomainLog(FileSystem fs, Path logPath,
    ObjectMapper objMapper, TimelineDomain domain,
    boolean isAppendSupported) throws IOException {
  checkAndStartTimeTasks();
  try {
    this.domainFDLocker.lock();
    if (this.domainLogFD != null) {
      this.domainLogFD.writeDomain(domain);
    } else {
      this.domainLogFD =
          new DomainLogFD(fs, logPath, objMapper, isAppendSupported);
      this.domainLogFD.writeDomain(domain);
    }
  } finally {
    this.domainFDLocker.unlock();
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:18,代码来源:FileSystemTimelineWriter.java


示例15: setup

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
@Before
public void setup() throws Exception {
  config.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, TEST_ROOT_DIR.toString());
  HdfsConfiguration hdfsConfig = new HdfsConfiguration();
  hdfsCluster = new MiniDFSCluster.Builder(hdfsConfig).numDataNodes(1).build();
  fs = hdfsCluster.getFileSystem();
  fc = FileContext.getFileContext(hdfsCluster.getURI(0), config);
  Path testAppDirPath = getTestRootPath(TEST_ATTEMPT_DIR_NAME);
  fs.mkdirs(testAppDirPath, new FsPermission(FILE_LOG_DIR_PERMISSIONS));
  objMapper = PluginStoreTestUtils.createObjectMapper();

  TimelineEntities testEntities = PluginStoreTestUtils.generateTestEntities();
  writeEntitiesLeaveOpen(testEntities,
      new Path(testAppDirPath, TEST_ENTITY_FILE_NAME));

  testDomain = new TimelineDomain();
  testDomain.setId("domain_1");
  testDomain.setReaders(UserGroupInformation.getLoginUser().getUserName());
  testDomain.setOwner(UserGroupInformation.getLoginUser().getUserName());
  testDomain.setDescription("description");
  writeDomainLeaveOpen(testDomain,
      new Path(testAppDirPath, TEST_DOMAIN_FILE_NAME));

  writeBrokenFile(new Path(testAppDirPath, TEST_BROKEN_FILE_NAME));
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:26,代码来源:TestLogInfo.java


示例16: testParseDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
@Test
public void testParseDomain() throws Exception {
  // Load test data
  TimelineDataManager tdm = PluginStoreTestUtils.getTdmWithMemStore(config);
  DomainLogInfo domainLogInfo = new DomainLogInfo(TEST_ATTEMPT_DIR_NAME,
      TEST_DOMAIN_FILE_NAME,
      UserGroupInformation.getLoginUser().getUserName());
  domainLogInfo.parseForStore(tdm, getTestRootPath(), true, jsonFactory, objMapper,
      fs);
  // Verify domain data
  TimelineDomain resultDomain = tdm.getDomain("domain_1",
      UserGroupInformation.getLoginUser());
  assertNotNull(resultDomain);
  assertEquals(testDomain.getReaders(), resultDomain.getReaders());
  assertEquals(testDomain.getOwner(), resultDomain.getOwner());
  assertEquals(testDomain.getDescription(), resultDomain.getDescription());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:18,代码来源:TestLogInfo.java


示例17: getDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入依赖的package包/类
@Override
public TimelineDomain getDomain(String domainId)
    throws IOException {
  if (getServiceStopped()) {
    LOG.info("Service stopped, return null for the storage");
    return null;
  }
  TimelineDomain domain = domainById.get(domainId);
  if (domain == null) {
    return null;
  } else {
    return KeyValueBasedTimelineStoreUtils.createTimelineDomain(
        domain.getId(),
        domain.getDescription(),
        domain.getOwner(),
        domain.getReaders(),
        domain.getWriters(),
        domain.getCreatedTime(),
        domain.getModifiedTime());
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:22,代码来源:KeyValueBasedTimelineStore.java



注:本文中的org.apache.hadoop.yarn.api.records.timeline.TimelineDomain类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RuntimeEvent类代码示例发布时间:2022-05-23
下一篇:
Java Vector4d类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap