gpt4 book ai didi

org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.conf.YarnConfigurationStore.logMutation()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 23:43:31 25 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.conf.YarnConfigurationStore.logMutation()方法的一些代码示例,展示了YarnConfigurationStore.logMutation()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnConfigurationStore.logMutation()方法的具体详情如下:
包路径:org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.conf.YarnConfigurationStore
类名称:YarnConfigurationStore
方法名:logMutation

YarnConfigurationStore.logMutation介绍

[英]Logs the configuration change to backing store.
[中]将配置更改记录到备份存储。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Override
public void logAndApplyMutation(UserGroupInformation user,
  SchedConfUpdateInfo confUpdate) throws Exception {
 oldConf = new Configuration(schedConf);
 Map<String, String> kvUpdate = constructKeyValueConfUpdate(confUpdate);
 LogMutation log = new LogMutation(kvUpdate, user.getShortUserName());
 confStore.logMutation(log);
 for (Map.Entry<String, String> kv : kvUpdate.entrySet()) {
  if (kv.getValue() == null) {
   schedConf.unset(kv.getKey());
  } else {
   schedConf.set(kv.getKey(), kv.getValue());
  }
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Test
 public void testNullConfigurationUpdate() throws Exception {
  schedConf.set("key", "val");
  confStore.initialize(conf, schedConf, rmContext);
  assertEquals("val", confStore.retrieve().get("key"));

  Map<String, String> update = new HashMap<>();
  update.put("key", null);
  YarnConfigurationStore.LogMutation mutation =
    new YarnConfigurationStore.LogMutation(update, TEST_USER);
  confStore.logMutation(mutation);
  confStore.confirmMutation(true);
  assertNull(confStore.retrieve().get("key"));
  confStore.close();
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Test
public void testConfigurationUpdate() throws Exception {
 schedConf.set("key1", "val1");
 confStore.initialize(conf, schedConf, rmContext);
 assertEquals("val1", confStore.retrieve().get("key1"));
 Map<String, String> update1 = new HashMap<>();
 update1.put("keyUpdate1", "valUpdate1");
 YarnConfigurationStore.LogMutation mutation1 =
   new YarnConfigurationStore.LogMutation(update1, TEST_USER);
 confStore.logMutation(mutation1);
 confStore.confirmMutation(true);
 assertEquals("valUpdate1", confStore.retrieve().get("keyUpdate1"));
 Map<String, String> update2 = new HashMap<>();
 update2.put("keyUpdate2", "valUpdate2");
 YarnConfigurationStore.LogMutation mutation2 =
   new YarnConfigurationStore.LogMutation(update2, TEST_USER);
 confStore.logMutation(mutation2);
 confStore.confirmMutation(false);
 assertNull("Configuration should not be updated",
   confStore.retrieve().get("keyUpdate2"));
 confStore.close();
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Test
public void testPersistUpdatedConfiguration() throws Exception {
 confStore.initialize(conf, schedConf, rmContext);
 assertNull(confStore.retrieve().get("key"));
 Map<String, String> update = new HashMap<>();
 update.put("key", "val");
 YarnConfigurationStore.LogMutation mutation =
   new YarnConfigurationStore.LogMutation(update, TEST_USER);
 confStore.logMutation(mutation);
 confStore.confirmMutation(true);
 assertEquals("val", confStore.retrieve().get("key"));
 // Create a new configuration store, and check for updated configuration
 confStore = createConfStore();
 schedConf.set("key", "badVal");
 // Should ignore passed-in scheduler configuration.
 confStore.initialize(conf, schedConf, rmContext);
 assertEquals("val", confStore.retrieve().get("key"));
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

YarnConfigurationStore.LogMutation mutation =
  new YarnConfigurationStore.LogMutation(update1, TEST_USER);
confStore.logMutation(mutation);
logs = ((LeveldbConfigurationStore) confStore).getLogs();
assertEquals(1, logs.size());
update2.put("key2", "val2");
mutation = new YarnConfigurationStore.LogMutation(update2, TEST_USER);
confStore.logMutation(mutation);
logs = ((LeveldbConfigurationStore) confStore).getLogs();
assertEquals(2, logs.size());
update3.put("key3", "val3");
mutation = new YarnConfigurationStore.LogMutation(update3, TEST_USER);
confStore.logMutation(mutation);
logs = ((LeveldbConfigurationStore) confStore).getLogs();
assertEquals(2, logs.size());

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

YarnConfigurationStore.LogMutation mutation =
  new YarnConfigurationStore.LogMutation(update1, TEST_USER);
confStore.logMutation(mutation);
logs = ((ZKConfigurationStore) confStore).getLogs();
assertEquals(1, logs.size());
update2.put("key2", "val2");
mutation = new YarnConfigurationStore.LogMutation(update2, TEST_USER);
confStore.logMutation(mutation);
logs = ((ZKConfigurationStore) confStore).getLogs();
assertEquals(2, logs.size());
update3.put("key3", "val3");
mutation = new YarnConfigurationStore.LogMutation(update3, TEST_USER);
confStore.logMutation(mutation);
logs = ((ZKConfigurationStore) confStore).getLogs();
assertEquals(2, logs.size());

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Test
public void testPersistUpdatedConfiguration() throws Exception {
 confStore.initialize(conf, schedConf, rmContext);
 assertNull(confStore.retrieve().get("key"));
 Map<String, String> update = new HashMap<>();
 update.put("key", "val");
 YarnConfigurationStore.LogMutation mutation =
   new YarnConfigurationStore.LogMutation(update, TEST_USER);
 confStore.logMutation(mutation);
 confStore.confirmMutation(true);
 assertEquals("val", confStore.retrieve().get("key"));
 confStore.close();
 // Create a new configuration store, and check for updated configuration
 confStore = createConfStore();
 schedConf.set("key", "badVal");
 // Should ignore passed-in scheduler configuration.
 confStore.initialize(conf, schedConf, rmContext);
 assertEquals("val", confStore.retrieve().get("key"));
 confStore.close();
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com