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

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

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

Resources.multiplyAndNormalizeDown介绍

暂无

代码示例

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

private Resource getCurrentLimitResource(String nodeLabel,
  Resource clusterResource, ResourceLimits currentResourceLimits) {
 /*
  * Current limit resource: For labeled resource: limit = queue-max-resource
  * (TODO, this part need update when we support labeled-limit) For
  * non-labeled resource: limit = min(queue-max-resource,
  * limit-set-by-parent)
  */
 Resource queueMaxResource =
   Resources.multiplyAndNormalizeDown(resourceCalculator,
     labelManager.getResourceByLabel(nodeLabel, clusterResource),
     queueCapacities.getAbsoluteMaximumCapacity(nodeLabel), minimumAllocation);
 if (nodeLabel.equals(RMNodeLabelsManager.NO_LABEL)) {
  return Resources.min(resourceCalculator, clusterResource,
    queueMaxResource, currentResourceLimits.getLimit());
 }
 return queueMaxResource;
}

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

private Resource getCurrentLimitResource(String nodeLabel,
  Resource clusterResource, ResourceLimits currentResourceLimits) {
 /*
  * Current limit resource: For labeled resource: limit = queue-max-resource
  * (TODO, this part need update when we support labeled-limit) For
  * non-labeled resource: limit = min(queue-max-resource,
  * limit-set-by-parent)
  */
 Resource queueMaxResource =
   Resources.multiplyAndNormalizeDown(resourceCalculator,
     labelManager.getResourceByLabel(nodeLabel, clusterResource),
     queueCapacities.getAbsoluteMaximumCapacity(nodeLabel), minimumAllocation);
 if (nodeLabel.equals(RMNodeLabelsManager.NO_LABEL)) {
  return Resources.min(resourceCalculator, clusterResource,
    queueMaxResource, currentResourceLimits.getLimit());
 }
 return queueMaxResource;
}

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

float weight = (user == null) ? 1.0f : user.getWeight();
Resource userSpecificUserLimit =
  Resources.multiplyAndNormalizeDown(resourceCalculator,
    userLimitResource, weight, lQueue.getMinimumAllocation());

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

float weight = (user == null) ? 1.0f : user.getWeight();
Resource userSpecificUserLimit =
  Resources.multiplyAndNormalizeDown(resourceCalculator,
    userLimitResource, weight, lQueue.getMinimumAllocation());

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

private void updateCurrentResourceLimits(
  ResourceLimits currentResourceLimits, Resource clusterResource) {
 // TODO: need consider non-empty node labels when resource limits supports
 // node labels
 // Even if ParentQueue will set limits respect child's max queue capacity,
 // but when allocating reserved container, CapacityScheduler doesn't do
 // this. So need cap limits by queue's max capacity here.
 this.cachedResourceLimitsForHeadroom = new ResourceLimits(currentResourceLimits.getLimit());
 Resource queueMaxResource =
   Resources.multiplyAndNormalizeDown(resourceCalculator, labelManager
     .getResourceByLabel(RMNodeLabelsManager.NO_LABEL, clusterResource),
     queueCapacities
       .getAbsoluteMaximumCapacity(RMNodeLabelsManager.NO_LABEL),
     minimumAllocation);
 this.cachedResourceLimitsForHeadroom.setLimit(Resources.min(resourceCalculator,
   clusterResource, queueMaxResource, currentResourceLimits.getLimit()));
}

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

private void updateCurrentResourceLimits(
  ResourceLimits currentResourceLimits, Resource clusterResource) {
 // TODO: need consider non-empty node labels when resource limits supports
 // node labels
 // Even if ParentQueue will set limits respect child's max queue capacity,
 // but when allocating reserved container, CapacityScheduler doesn't do
 // this. So need cap limits by queue's max capacity here.
 this.cachedResourceLimitsForHeadroom = new ResourceLimits(currentResourceLimits.getLimit());
 Resource queueMaxResource =
   Resources.multiplyAndNormalizeDown(resourceCalculator, labelManager
     .getResourceByLabel(RMNodeLabelsManager.NO_LABEL, clusterResource),
     queueCapacities
       .getAbsoluteMaximumCapacity(RMNodeLabelsManager.NO_LABEL),
     minimumAllocation);
 this.cachedResourceLimitsForHeadroom.setLimit(Resources.min(resourceCalculator,
   clusterResource, queueMaxResource, currentResourceLimits.getLimit()));
}

代码示例来源: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: 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);
}

相关文章