当前位置: 首页>>代码示例>>Java>>正文


Java PersistencePolicies类代码示例

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


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

示例1: testChildDeletion

import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies; //导入依赖的package包/类
@Test
public void testChildDeletion() throws Throwable {
  ServiceRecord app = createRecord("app1",
      PersistencePolicies.APPLICATION, "app",
      null);
  ServiceRecord container = createRecord("container1",
      PersistencePolicies.CONTAINER, "container",
      null);

  operations.bind("/app", app, BindFlags.OVERWRITE);
  operations.bind("/app/container", container, BindFlags.OVERWRITE);

  try {
    int p = purge("/",
        "app1",
        PersistencePolicies.APPLICATION,
        RegistryAdminService.PurgePolicy.FailOnChildren);
    fail("expected a failure, got a purge count of " + p);
  } catch (PathIsNotEmptyDirectoryException expected) {
    // expected
  }

}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestRegistryRMOperations.java

示例2: registerComponent

import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies; //导入依赖的package包/类
/**
 * Handler for {@link RegisterComponentInstance action}
 * Register/re-register an ephemeral container that is already in the app state
 * @param id the component
 * @param description
 */
public boolean registerComponent(ContainerId id, String description) throws
    IOException {
  RoleInstance instance = appState.getOwnedContainer(id);
  if (instance == null) {
    return false;
  }
  // this is where component registrations  go
  log.info("Registering component {}", id);
  String cid = RegistryPathUtils.encodeYarnID(id.toString());
  ServiceRecord container = new ServiceRecord();
  container.set(YarnRegistryAttributes.YARN_ID, cid);
  container.description = description;
  container.set(YarnRegistryAttributes.YARN_PERSISTENCE,
      PersistencePolicies.CONTAINER);
  try {
    yarnRegistryOperations.putComponent(cid, container);
  } catch (IOException e) {
    log.warn("Failed to register container {}/{}: {}",
        id, description, e, e);
  }
  return true;
}
 
开发者ID:apache,项目名称:incubator-slider,代码行数:29,代码来源:SliderAppMaster.java

示例3: onApplicationCompleted

import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies; //导入依赖的package包/类
/**
 * Actions to take when an application is completed
 * @param id  application  ID
 * @throws IOException problems
 */
public void onApplicationCompleted(ApplicationId id)
    throws IOException {
  LOG.info("Application {} completed, purging application-level records",
      id);
  purgeRecordsAsync("/",
      id.toString(),
      PersistencePolicies.APPLICATION);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:RMRegistryOperationsService.java

示例4: onContainerFinished

import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies; //导入依赖的package包/类
/**
 * Actions to take when the AM container is completed
 * @param id  container ID
 * @throws IOException problems
 */
public void onContainerFinished(ContainerId id) throws IOException {
  LOG.info("Container {} finished, purging container-level records",
      id);
  purgeRecordsAsync("/",
      id.toString(),
      PersistencePolicies.CONTAINER);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:RMRegistryOperationsService.java

示例5: testPutGetContainerPersistenceServiceEntry

import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies; //导入依赖的package包/类
@Test
public void testPutGetContainerPersistenceServiceEntry() throws Throwable {

  String path = ENTRY_PATH;
  ServiceRecord written = buildExampleServiceEntry(
      PersistencePolicies.CONTAINER);

  operations.mknode(RegistryPathUtils.parentOf(path), true);
  operations.bind(path, written, BindFlags.CREATE);
  ServiceRecord resolved = operations.resolve(path);
  validateEntry(resolved);
  assertMatches(written, resolved);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestRegistryRMOperations.java

示例6: testPutGetServiceEntry

import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies; //导入依赖的package包/类
@Test
public void testPutGetServiceEntry() throws Throwable {
  ServiceRecord written = putExampleServiceEntry(ENTRY_PATH, 0,
      PersistencePolicies.APPLICATION);
  ServiceRecord resolved = operations.resolve(ENTRY_PATH);
  validateEntry(resolved);
  assertMatches(written, resolved);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:TestRegistryOperations.java

示例7: testListListFully

import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies; //导入依赖的package包/类
@Test
public void testListListFully() throws Throwable {
  ServiceRecord r1 = new ServiceRecord();
  ServiceRecord r2 = createRecord("i",
      PersistencePolicies.PERMANENT, "r2");

  String path = USERPATH + SC_HADOOP + "/listing" ;
  operations.mknode(path, true);
  String r1path = path + "/r1";
  operations.bind(r1path, r1, 0);
  String r2path = path + "/r2";
  operations.bind(r2path, r2, 0);

  RegistryPathStatus r1stat = operations.stat(r1path);
  assertEquals("r1", r1stat.path);
  RegistryPathStatus r2stat = operations.stat(r2path);
  assertEquals("r2", r2stat.path);
  assertNotEquals(r1stat, r2stat);

  // listings now
  List<String> list = operations.list(path);
  assertEquals("Wrong no. of children", 2, list.size());
  // there's no order here, so create one
  Map<String, String> names = new HashMap<String, String>();
  String entries = "";
  for (String child : list) {
    names.put(child, child);
    entries += child + " ";
  }
  assertTrue("No 'r1' in " + entries,
      names.containsKey("r1"));
  assertTrue("No 'r2' in " + entries,
      names.containsKey("r2"));

  Map<String, RegistryPathStatus> stats =
      RegistryUtils.statChildren(operations, path);
  assertEquals("Wrong no. of children", 2, stats.size());
  assertEquals(r1stat, stats.get("r1"));
  assertEquals(r2stat, stats.get("r2"));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:41,代码来源:TestRegistryOperations.java

示例8: testRoundTrip

import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies; //导入依赖的package包/类
@Test
public void testRoundTrip() throws Throwable {
  String persistence = PersistencePolicies.PERMANENT;
  ServiceRecord record = createRecord(persistence);
  record.set("customkey", "customvalue");
  record.set("customkey2", "customvalue2");
  RegistryTypeUtils.validateServiceRecord("", record);
  LOG.info(marshal.toJson(record));
  byte[] bytes = marshal.toBytes(record);
  ServiceRecord r2 = marshal.fromBytes("", bytes);
  assertMatches(record, r2);
  RegistryTypeUtils.validateServiceRecord("", r2);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestMarshalling.java

示例9: testUnknownFieldsRoundTrip

import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies; //导入依赖的package包/类
@Test
public void testUnknownFieldsRoundTrip() throws Throwable {
  ServiceRecord record =
      createRecord(PersistencePolicies.APPLICATION_ATTEMPT);
  record.set("key", "value");
  record.set("intval", "2");
  assertEquals("value", record.get("key"));
  assertEquals("2", record.get("intval"));
  assertNull(record.get("null"));
  assertEquals("defval", record.get("null", "defval"));
  byte[] bytes = marshal.toBytes(record);
  ServiceRecord r2 = marshal.fromBytes("", bytes);
  assertEquals("value", r2.get("key"));
  assertEquals("2", r2.get("intval"));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestMarshalling.java

示例10: testFieldPropagationInCopy

import org.apache.hadoop.registry.client.types.yarn.PersistencePolicies; //导入依赖的package包/类
@Test
public void testFieldPropagationInCopy() throws Throwable {
  ServiceRecord record =
      createRecord(PersistencePolicies.APPLICATION_ATTEMPT);
  record.set("key", "value");
  record.set("intval", "2");
  ServiceRecord that = new ServiceRecord(record);
  assertMatches(record, that);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:TestMarshalling.java


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