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

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

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

Resources.roundDown介绍

暂无

代码示例

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

private Resource getHeadroom(User user, Resource currentResourceLimit,
  Resource clusterResource, Resource userLimit) {
 /** 
  * Headroom is:
  *    min(
  *        min(userLimit, queueMaxCap) - userConsumed,
  *        queueMaxCap - queueUsedResources
  *       )
  * 
  * ( which can be expressed as, 
  *  min (userLimit - userConsumed, queuMaxCap - userConsumed, 
  *    queueMaxCap - queueUsedResources)
  *  )
  *
  * given that queueUsedResources >= userConsumed, this simplifies to
  *
  * >> min (userlimit - userConsumed,   queueMaxCap - queueUsedResources) << 
  *
  */
 Resource headroom = 
  Resources.componentwiseMin(
   Resources.subtract(userLimit, user.getUsed()),
   Resources.subtract(currentResourceLimit, queueUsage.getUsed())
   );
 // Normalize it before return
 headroom =
   Resources.roundDown(resourceCalculator, headroom, minimumAllocation);
 return headroom;
}

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

private Resource getHeadroom(User user, Resource currentResourceLimit,
  Resource clusterResource, Resource userLimit) {
 /** 
  * Headroom is:
  *    min(
  *        min(userLimit, queueMaxCap) - userConsumed,
  *        queueMaxCap - queueUsedResources
  *       )
  * 
  * ( which can be expressed as, 
  *  min (userLimit - userConsumed, queuMaxCap - userConsumed, 
  *    queueMaxCap - queueUsedResources)
  *  )
  *
  * given that queueUsedResources >= userConsumed, this simplifies to
  *
  * >> min (userlimit - userConsumed,   queueMaxCap - queueUsedResources) << 
  *
  */
 Resource headroom = 
  Resources.componentwiseMin(
   Resources.subtract(userLimit, user.getUsed()),
   Resources.subtract(currentResourceLimit, queueUsage.getUsed())
   );
 // Normalize it before return
 headroom =
   Resources.roundDown(resourceCalculator, headroom, minimumAllocation);
 return headroom;
}

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

private ResourceLimits getResourceLimitsOfChild(CSQueue child,
  Resource clusterResource, ResourceLimits parentLimits) {
 // Set resource-limit of a given child, child.limit =
 // min(my.limit - my.used + child.used, child.max)
 // Parent available resource = parent-limit - parent-used-resource
 Resource parentMaxAvailableResource =
   Resources.subtract(parentLimits.getLimit(), getUsedResources());
 // Child's limit = parent-available-resource + child-used
 Resource childLimit =
   Resources.add(parentMaxAvailableResource, child.getUsedResources());
 // Get child's max resource
 Resource childConfiguredMaxResource =
   Resources.multiplyAndNormalizeDown(resourceCalculator, labelManager
     .getResourceByLabel(RMNodeLabelsManager.NO_LABEL, clusterResource),
     child.getAbsoluteMaximumCapacity(), minimumAllocation);
 // Child's limit should be capped by child configured max resource
 childLimit =
   Resources.min(resourceCalculator, clusterResource, childLimit,
     childConfiguredMaxResource);
 // Normalize before return
 childLimit =
   Resources.roundDown(resourceCalculator, childLimit, minimumAllocation);
 return new ResourceLimits(childLimit);
}

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

private ResourceLimits getResourceLimitsOfChild(CSQueue child,
  Resource clusterResource, Resource parentLimits,
  String nodePartition) {
 // Set resource-limit of a given child, child.limit =
 // min(my.limit - my.used + child.used, child.max)
 // Parent available resource = parent-limit - parent-used-resource
 Resource parentMaxAvailableResource = Resources.subtract(
   parentLimits, queueUsage.getUsed(nodePartition));
 // Deduct killable from used
 Resources.addTo(parentMaxAvailableResource,
   getTotalKillableResource(nodePartition));
 // Child's limit = parent-available-resource + child-used
 Resource childLimit = Resources.add(parentMaxAvailableResource,
   child.getQueueResourceUsage().getUsed(nodePartition));
 // Get child's max resource
 Resource childConfiguredMaxResource = child
   .getEffectiveMaxCapacityDown(nodePartition, minimumAllocation);
 // Child's limit should be capped by child configured max resource
 childLimit =
   Resources.min(resourceCalculator, clusterResource, childLimit,
     childConfiguredMaxResource);
 // Normalize before return
 childLimit =
   Resources.roundDown(resourceCalculator, childLimit, minimumAllocation);
 return new ResourceLimits(childLimit);
}

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

private ResourceLimits getResourceLimitsOfChild(CSQueue child,
  Resource clusterResource, ResourceLimits parentLimits) {
 // Set resource-limit of a given child, child.limit =
 // min(my.limit - my.used + child.used, child.max)
 // Parent available resource = parent-limit - parent-used-resource
 Resource parentMaxAvailableResource =
   Resources.subtract(parentLimits.getLimit(), getUsedResources());
 // Child's limit = parent-available-resource + child-used
 Resource childLimit =
   Resources.add(parentMaxAvailableResource, child.getUsedResources());
 // Get child's max resource
 Resource childConfiguredMaxResource =
   Resources.multiplyAndNormalizeDown(resourceCalculator, labelManager
     .getResourceByLabel(RMNodeLabelsManager.NO_LABEL, clusterResource),
     child.getAbsoluteMaximumCapacity(), minimumAllocation);
 // Child's limit should be capped by child configured max resource
 childLimit =
   Resources.min(resourceCalculator, clusterResource, childLimit,
     childConfiguredMaxResource);
 // Normalize before return
 childLimit =
   Resources.roundDown(resourceCalculator, childLimit, minimumAllocation);
 return new ResourceLimits(childLimit);
}

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

Resources.roundDown(resourceCalculator, headroom, minimumAllocation);

相关文章