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

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

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

AllocationConfiguration.getMaxResources介绍

[英]Get the maximum resource allocation for the given queue.
[中]获取给定队列的最大资源分配。

代码示例

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

@Override
public Resource getMaxShare() {
 return scheduler.getAllocationConfiguration().getMaxResources(getName());
}

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

@Override
public Resource getMaxShare() {
 return scheduler.getAllocationConfiguration().getMaxResources(getName());
}

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

/**
 * Helper method to check if the queue should attempt assigning resources
 * 
 * @return true if check passes (can assign) or false otherwise
 */
protected boolean assignContainerPreCheck(FSSchedulerNode node) {
 if (!Resources.fitsIn(getResourceUsage(),
   scheduler.getAllocationConfiguration().getMaxResources(getName()))
   || node.getReservedContainer() != null) {
  return false;
 }
 return true;
}

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

@Override
public void updateDemand() {
 // Compute demand by iterating through apps in the queue
 // Limit demand to maxResources
 Resource maxRes = scheduler.getAllocationConfiguration()
   .getMaxResources(getName());
 demand = Resources.createResource(0);
 readLock.lock();
 try {
  for (FSAppAttempt sched : runnableApps) {
   if (Resources.equals(demand, maxRes)) {
    break;
   }
   updateDemandForApp(sched, maxRes);
  }
  for (FSAppAttempt sched : nonRunnableApps) {
   if (Resources.equals(demand, maxRes)) {
    break;
   }
   updateDemandForApp(sched, maxRes);
  }
 } finally {
  readLock.unlock();
 }
 if (LOG.isDebugEnabled()) {
  LOG.debug("The updated demand for " + getName() + " is " + demand
    + "; the max is " + maxRes);
 }
}

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

/**
 * Helper method to check if the queue should attempt assigning resources
 * 
 * @return true if check passes (can assign) or false otherwise
 */
protected boolean assignContainerPreCheck(FSSchedulerNode node) {
 if (!Resources.fitsIn(getResourceUsage(),
   scheduler.getAllocationConfiguration().getMaxResources(getName()))
   || node.getReservedContainer() != null) {
  return false;
 }
 return true;
}

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

@Override
public void updateDemand() {
 // Compute demand by iterating through apps in the queue
 // Limit demand to maxResources
 Resource maxRes = scheduler.getAllocationConfiguration()
   .getMaxResources(getName());
 demand = Resources.createResource(0);
 readLock.lock();
 try {
  for (FSAppAttempt sched : runnableApps) {
   if (Resources.equals(demand, maxRes)) {
    break;
   }
   updateDemandForApp(sched, maxRes);
  }
  for (FSAppAttempt sched : nonRunnableApps) {
   if (Resources.equals(demand, maxRes)) {
    break;
   }
   updateDemandForApp(sched, maxRes);
  }
 } finally {
  readLock.unlock();
 }
 if (LOG.isDebugEnabled()) {
  LOG.debug("The updated demand for " + getName() + " is " + demand
    + "; the max is " + maxRes);
 }
}

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

@Override
public void updateDemand() {
 // Compute demand by iterating through apps in the queue
 // Limit demand to maxResources
 Resource maxRes = scheduler.getAllocationConfiguration()
   .getMaxResources(getName());
 demand = Resources.createResource(0);
 for (FSQueue childQueue : childQueues) {
  childQueue.updateDemand();
  Resource toAdd = childQueue.getDemand();
  if (LOG.isDebugEnabled()) {
   LOG.debug("Counting resource from " + childQueue.getName() + " " + 
     toAdd + "; Total resource consumption for " + getName() +
     " now " + demand);
  }
  demand = Resources.add(demand, toAdd);
  demand = Resources.componentwiseMin(demand, maxRes);
  if (Resources.equals(demand, maxRes)) {
   break;
  }
 }
 if (LOG.isDebugEnabled()) {
  LOG.debug("The updated demand for " + getName() + " is " + demand +
    "; the max is " + maxRes);
 }    
}

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

@Override
public void updateDemand() {
 // Compute demand by iterating through apps in the queue
 // Limit demand to maxResources
 Resource maxRes = scheduler.getAllocationConfiguration()
   .getMaxResources(getName());
 demand = Resources.createResource(0);
 for (FSQueue childQueue : childQueues) {
  childQueue.updateDemand();
  Resource toAdd = childQueue.getDemand();
  if (LOG.isDebugEnabled()) {
   LOG.debug("Counting resource from " + childQueue.getName() + " " + 
     toAdd + "; Total resource consumption for " + getName() +
     " now " + demand);
  }
  demand = Resources.add(demand, toAdd);
  demand = Resources.componentwiseMin(demand, maxRes);
  if (Resources.equals(demand, maxRes)) {
   break;
  }
 }
 if (LOG.isDebugEnabled()) {
  LOG.debug("The updated demand for " + getName() + " is " + demand +
    "; the max is " + maxRes);
 }    
}

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

@Test
public void testUpdateDemand() {
 conf.set(FairSchedulerConfiguration.ASSIGN_MULTIPLE, "false");
 resourceManager = new MockRM(conf);
 resourceManager.start();
 scheduler = (FairScheduler) resourceManager.getResourceScheduler();
 scheduler.allocConf = mock(AllocationConfiguration.class);
 String queueName = "root.queue1";
 when(scheduler.allocConf.getMaxResources(queueName)).thenReturn(maxResource);
 when(scheduler.allocConf.getMinResources(queueName)).thenReturn(Resources.none());
 FSLeafQueue schedulable = new FSLeafQueue(queueName, scheduler, null);
 FSAppAttempt app = mock(FSAppAttempt.class);
 Mockito.when(app.getDemand()).thenReturn(maxResource);
 schedulable.addAppSchedulable(app);
 schedulable.addAppSchedulable(app);
 schedulable.updateDemand();
 assertTrue("Demand is greater than max allowed ",
   Resources.equals(schedulable.getDemand(), maxResource));
}

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

/**
  * Initialize a {@link FSQueue} with queue-specific properties and its
  * metrics.
  * @param queue the FSQueue needed to be initialized
  */
 public void initFSQueue(FSQueue queue){
  // Set queue-specific properties.
  String name = queue.getName();
  queue.setWeights(getQueueWeight(name));
  queue.setMinShare(getMinResources(name));
  queue.setMaxShare(getMaxResources(name));
  queue.setMaxRunningApps(getQueueMaxApps(name));
  queue.setMaxAMShare(getQueueMaxAMShare(name));
  queue.setMaxChildQueueResource(getMaxChildResources(name));
  queue.setMaxContainerAllocation(getQueueMaxContainerAllocation(name));

  // Set queue metrics.
  queue.getMetrics().setMinShare(queue.getMinShare());
  queue.getMetrics().setMaxShare(queue.getMaxShare());
  queue.getMetrics().setMaxApps(queue.getMaxRunningApps());
  queue.getMetrics().setSchedulingPolicy(getSchedulingPolicy(name).getName());
 }
}

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

queueConf.getMaxResources("root.queueA").getResource());
assertEquals(Resources.createResource(5120, 110),
  queueConf.getMaxResources("root.queueB").getResource());
assertEquals(Resources.createResource(4096, 100),
  queueConf.getMaxResources("root.queueC").getResource());
assertEquals(Resources.createResource(4096, 100),
  queueConf.getMaxResources("root.queueD").getResource());
assertEquals(Resources.createResource(4096, 100),
  queueConf.getMaxResources("root.queueE").getResource());
assertEquals(Resources.createResource(4096, 100),
  queueConf.getMaxResources("root.queueF").getResource());
assertEquals(Resources.createResource(4096, 100),
  queueConf.getMaxResources("root.queueG").getResource());
assertEquals(Resources.createResource(4096, 100),
  queueConf.getMaxResources("root.queueG.queueH").getResource());

相关文章

微信公众号

最新文章

更多