org.apache.hadoop.yarn.util.resource.Resources.ratio()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(102)

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

Resources.ratio介绍

暂无

代码示例

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

/**
 * Resizes reservations based on currently available resources.
 */
private Resource calculateReservationToPlanProportion(
  ResourceCalculator rescCalculator, Resource availablePlanResources,
  Resource totalReservationResources, Resource reservationResources) {
 return Resources.multiply(availablePlanResources, Resources.ratio(
   rescCalculator, reservationResources, totalReservationResources));
}

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

public float updateUsageRatio(ResourceCalculator resourceCalculator,
  Resource resource, String nodePartition) {
 try {
  writeLock.lock();
  float delta;
  float newRatio = Resources.ratio(resourceCalculator,
    getUsed(nodePartition), resource);
  delta = newRatio - userUsageRatios.getUsageRatio(nodePartition);
  userUsageRatios.setUsageRatio(nodePartition, newRatio);
  return delta;
 } finally {
  writeLock.unlock();
 }
}

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

boolean shouldAllocOrReserveNewContainer(FiCaSchedulerApp application,
  Priority priority, Resource required) {
 int requiredContainers = application.getTotalRequiredResources(priority);
 int reservedContainers = application.getNumReservedContainers(priority);
 int starvation = 0;
 if (reservedContainers > 0) {
  float nodeFactor = 
    Resources.ratio(
      resourceCalculator, required, getMaximumAllocation()
      );
  
  // Use percentage of node required to bias against large containers...
  // Protect against corner case where you need the whole node with
  // Math.min(nodeFactor, minimumAllocationFactor)
  starvation = 
    (int)((application.getReReservations(priority) / (float)reservedContainers) * 
       (1.0f - (Math.min(nodeFactor, getMinimumAllocationFactor())))
       );
  
  if (LOG.isDebugEnabled()) {
   LOG.debug("needsContainers:" +
     " app.#re-reserve=" + application.getReReservations(priority) + 
     " reserved=" + reservedContainers + 
     " nodeFactor=" + nodeFactor + 
     " minAllocFactor=" + getMinimumAllocationFactor() +
     " starvation=" + starvation);
  }
 }
 return (((starvation + requiredContainers) - reservedContainers) > 0);
}

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

boolean shouldAllocOrReserveNewContainer(FiCaSchedulerApp application,
  Priority priority, Resource required) {
 int requiredContainers = application.getTotalRequiredResources(priority);
 int reservedContainers = application.getNumReservedContainers(priority);
 int starvation = 0;
 if (reservedContainers > 0) {
  float nodeFactor = 
    Resources.ratio(
      resourceCalculator, required, getMaximumAllocation()
      );
  
  // Use percentage of node required to bias against large containers...
  // Protect against corner case where you need the whole node with
  // Math.min(nodeFactor, minimumAllocationFactor)
  starvation = 
    (int)((application.getReReservations(priority) / (float)reservedContainers) * 
       (1.0f - (Math.min(nodeFactor, getMinimumAllocationFactor())))
       );
  
  if (LOG.isDebugEnabled()) {
   LOG.debug("needsContainers:" +
     " app.#re-reserve=" + application.getReReservations(priority) + 
     " reserved=" + reservedContainers + 
     " nodeFactor=" + nodeFactor + 
     " minAllocFactor=" + getMinimumAllocationFactor() +
     " starvation=" + starvation);
  }
 }
 return (((starvation + requiredContainers) - reservedContainers) > 0);
}

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

boolean shouldAllocOrReserveNewContainer(
  SchedulerRequestKey schedulerKey, Resource required) {
 int requiredContainers =
   application.getOutstandingAsksCount(schedulerKey);
 int reservedContainers = application.getNumReservedContainers(schedulerKey);
 int starvation = 0;
 if (reservedContainers > 0) {
  float nodeFactor = Resources.ratio(
    rc, required, application.getCSLeafQueue().getMaximumAllocation());
  // Use percentage of node required to bias against large containers...
  // Protect against corner case where you need the whole node with
  // Math.min(nodeFactor, minimumAllocationFactor)
  starvation =
    (int) ((application.getReReservations(schedulerKey) /
      (float) reservedContainers) * (1.0f - (Math.min(
        nodeFactor, application.getCSLeafQueue()
        .getMinimumAllocationFactor()))));
  if (LOG.isDebugEnabled()) {
   LOG.debug("needsContainers:" + " app.#re-reserve="
     + application.getReReservations(schedulerKey) + " reserved="
     + reservedContainers + " nodeFactor=" + nodeFactor
     + " minAllocFactor="
     + application.getCSLeafQueue().getMinimumAllocationFactor()
     + " starvation=" + starvation);
  }
 }
 return (((starvation + requiredContainers) - reservedContainers) > 0);
}

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

Resources.ratio(resourceCalculator,
  Resources.subtract(maximumAllocation, minimumAllocation),
  maximumAllocation);

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

Resources.ratio(resourceCalculator,
  Resources.subtract(maximumAllocation, minimumAllocation),
  maximumAllocation);

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

Resources.ratio(scheduler.getResourceCalculator(),
    pending, rr.getCapability()));
if (numContainersThatFit == 0) {

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

this.minimumAllocationFactor = Resources.ratio(resourceCalculator,
  Resources.subtract(maximumAllocation, minimumAllocation),
  maximumAllocation);

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

float ratio = Resources.ratio(rc, totalSelected,
  reservedContainer.getReservedResource());

相关文章