org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationFileLoaderService.reloadAllocations()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(16.9k)|赞(0)|评价(0)|浏览(163)

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

AllocationFileLoaderService.reloadAllocations介绍

[英]Updates the allocation list from the allocation config file. This file is expected to be in the XML format specified in the design doc.
[中]从分配配置文件更新分配列表。该文件应为设计文件中指定的XML格式。

代码示例

代码示例来源:origin: apache/hive

allocsLoader.reloadAllocations();
} catch (Exception ex) {
 throw new IOException("Failed to load queue allocations", ex);

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

@Override
public void reinitialize(Configuration conf, RMContext rmContext)
  throws IOException {
 try {
  allocsLoader.reloadAllocations();
 } catch (Exception e) {
  LOG.error("Failed to reload allocations file", e);
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Override
public void reinitialize(Configuration conf, RMContext rmContext)
  throws IOException {
 try {
  allocsLoader.reloadAllocations();
 } catch (Exception e) {
  LOG.error("Failed to reload allocations file", e);
 }
}

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

@Override
public void reinitialize(Configuration conf, RMContext rmContext)
  throws IOException {
 try {
  allocsLoader.reloadAllocations();
  super.reinitialize(conf, rmContext);
 } catch (Exception e) {
  LOG.error("Failed to reload allocations file", e);
 }
 try {
  refreshMaximumAllocation(
    ResourceUtils.fetchMaximumAllocationFromConfig(conf));
 } catch (Exception e) {
  LOG.error("Failed to refresh maximum allocation", e);
 }
}

代码示例来源:origin: org.apache.hive.shims/hive-shims-scheduler

allocsLoader.reloadAllocations();
} catch (Exception ex) {
 throw new IOException("Failed to load queue allocations", ex);

代码示例来源:origin: org.spark-project.hive.shims/hive-shims-scheduler

allocsLoader.reloadAllocations();
} catch (Exception ex) {
 throw new IOException("Failed to load queue allocations", ex);

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

/**
 * Verify that you can't have the queue name with just a non breaking
 * whitespace in the allocations file.
 */
@Test (expected = AllocationConfigurationException.class)
public void testQueueNameContainingNBWhitespace() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new OutputStreamWriter(
   new FileOutputStream(ALLOC_FILE), StandardCharsets.UTF_8));
 out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
 out.println("<allocations>");
 out.println("<queue name=\"\u00a0\">");
 out.println("</queue>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
}

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

/**
 * Verify that defaultQueueSchedulingMode can't accept FIFO as a value.
 */
@Test (expected = AllocationConfigurationException.class)
public void testDefaultQueueSchedulingModeIsFIFO() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("<defaultQueueSchedulingPolicy>fifo</defaultQueueSchedulingPolicy>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
}

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

/**
 * Verify that you can't include periods as the queue name in the allocations
 * file.
 */
@Test (expected = AllocationConfigurationException.class)
public void testQueueNameContainingPeriods() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("<queue name=\"parent1.child1\">");
 out.println("</queue>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
}

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

/**
 * Verify that you can't place queues at the same level as the root queue in
 * the allocations file.
 */
@Test (expected = AllocationConfigurationException.class)
public void testQueueAlongsideRoot() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("<queue name=\"root\">");
 out.println("</queue>");
 out.println("<queue name=\"other\">");
 out.println("</queue>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
}

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

/**
 * Verify that you can't have the queue name with whitespace only in the
 * allocations file.
 */
@Test (expected = AllocationConfigurationException.class)
public void testQueueNameContainingOnlyWhitespace() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("<queue name=\"      \">");
 out.println("</queue>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

/**
 * Verify that you can't include periods as the queue name in the allocations
 * file.
 */
@Test (expected = AllocationConfigurationException.class)
public void testQueueNameContainingPeriods() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("<queue name=\"parent1.child1\">");
 out.println("</queue>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

/**
 * Verify that you can't place queues at the same level as the root queue in
 * the allocations file.
 */
@Test (expected = AllocationConfigurationException.class)
public void testQueueAlongsideRoot() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("<queue name=\"root\">");
 out.println("</queue>");
 out.println("<queue name=\"other\">");
 out.println("</queue>");
 out.println("</allocations>");
 out.close();
 
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
}

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

/**
 * Verify that you can't have dynamic user queue and reservable queue on
 * the same queue
 */
@Test (expected = AllocationConfigurationException.class)
public void testReservableCannotBeCombinedWithDynamicUserQueue()
  throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("<queue name=\"notboth\" type=\"parent\" >");
 out.println("<reservation>");
 out.println("</reservation>");
 out.println("</queue>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

/**
 * Verify that you can't have dynamic user queue and reservable queue on
 * the same queue
 */
@Test (expected = AllocationConfigurationException.class)
public void testReservableCannotBeCombinedWithDynamicUserQueue()
  throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("<queue name=\"notboth\" type=\"parent\" >");
 out.println("<reservation>");
 out.println("</reservation>");
 out.println("</queue>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
}

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

@Test
public void testParentWithReservation() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("<queue name=\"parent\">");
 out.println("<reservation>");
 out.println("</reservation>");
 out.println(" <queue name=\"child\">");
 out.println(" </queue>");
 out.println("</queue>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 try {
  allocLoader.reloadAllocations();
 } catch (AllocationConfigurationException ex) {
  assertEquals(ex.getMessage(), "The configuration settings for root.parent"
    + " are invalid. A queue element that contains child queue elements"
    + " or that has the type='parent' attribute cannot also include a"
    + " reservation element.");
 }
}

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

@Test
public void testParentTagWithChild() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("<queue name=\"parent\" type=\"parent\">");
 out.println(" <queue name=\"child\">");
 out.println(" </queue>");
 out.println("</queue>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
 AllocationConfiguration queueConf = confHolder.allocConf;
 // Check whether queue 'parent' and 'child' are loaded successfully
 assertTrue(queueConf.getConfiguredQueues().get(FSQueueType.PARENT)
   .contains("root.parent"));
 assertTrue(queueConf.getConfiguredQueues().get(FSQueueType.LEAF)
   .contains("root.parent.child"));
}

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

@Test
public void testParentTagWithReservation() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("<queue name=\"parent\" type=\"parent\">");
 out.println("<reservation>");
 out.println("</reservation>");
 out.println("</queue>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 try {
  allocLoader.reloadAllocations();
 } catch (AllocationConfigurationException ex) {
  assertEquals(ex.getMessage(), "The configuration settings for root.parent"
    + " are invalid. A queue element that contains child queue elements"
    + " or that has the type='parent' attribute cannot also include a"
    + " reservation element.");
 }
}

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

@Test
public void testSimplePlacementPolicyFromConf() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 conf.setBoolean(FairSchedulerConfiguration.ALLOW_UNDECLARED_POOLS, false);
 conf.setBoolean(FairSchedulerConfiguration.USER_AS_DEFAULT_QUEUE, false);
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("</allocations>");
 out.close();
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
 AllocationConfiguration allocConf = confHolder.allocConf;
 QueuePlacementPolicy placementPolicy = allocConf.getPlacementPolicy();
 List<QueuePlacementRule> rules = placementPolicy.getRules();
 assertEquals(2, rules.size());
 assertEquals(QueuePlacementRule.Specified.class, rules.get(0).getClass());
 assertEquals(false, rules.get(0).create);
 assertEquals(QueuePlacementRule.Default.class, rules.get(1).getClass());
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Test
public void testSimplePlacementPolicyFromConf() throws Exception {
 Configuration conf = new Configuration();
 conf.set(FairSchedulerConfiguration.ALLOCATION_FILE, ALLOC_FILE);
 conf.setBoolean(FairSchedulerConfiguration.ALLOW_UNDECLARED_POOLS, false);
 conf.setBoolean(FairSchedulerConfiguration.USER_AS_DEFAULT_QUEUE, false);
 
 PrintWriter out = new PrintWriter(new FileWriter(ALLOC_FILE));
 out.println("<?xml version=\"1.0\"?>");
 out.println("<allocations>");
 out.println("</allocations>");
 out.close();
 
 AllocationFileLoaderService allocLoader = new AllocationFileLoaderService();
 allocLoader.init(conf);
 ReloadListener confHolder = new ReloadListener();
 allocLoader.setReloadListener(confHolder);
 allocLoader.reloadAllocations();
 AllocationConfiguration allocConf = confHolder.allocConf;
 
 QueuePlacementPolicy placementPolicy = allocConf.getPlacementPolicy();
 List<QueuePlacementRule> rules = placementPolicy.getRules();
 assertEquals(2, rules.size());
 assertEquals(QueuePlacementRule.Specified.class, rules.get(0).getClass());
 assertEquals(false, rules.get(0).create);
 assertEquals(QueuePlacementRule.Default.class, rules.get(1).getClass());
}

相关文章