本文整理了Java中org.apache.hadoop.yarn.util.resource.Resources.lessThan
方法的一些代码示例,展示了Resources.lessThan
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resources.lessThan
方法的具体详情如下:
包路径:org.apache.hadoop.yarn.util.resource.Resources
类名称:Resources
方法名:lessThan
暂无
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
if (Resources.lessThan(resourceCalculator, clusterResource,
node.getAvailableResource(), minimumAllocation)) {
break;
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common
private void assertResourcesOperations(Resource clusterResource,
Resource lhs, Resource rhs, boolean lessThan, boolean lessThanOrEqual,
boolean greaterThan, boolean greaterThanOrEqual, Resource max,
Resource min) {
Assert.assertEquals("Less Than operation is wrongly calculated.", lessThan,
Resources.lessThan(resourceCalculator, clusterResource, lhs, rhs));
Assert.assertEquals(
"Less Than Or Equal To operation is wrongly calculated.",
lessThanOrEqual, Resources.lessThanOrEqual(resourceCalculator,
clusterResource, lhs, rhs));
Assert.assertEquals("Greater Than operation is wrongly calculated.",
greaterThan,
Resources.greaterThan(resourceCalculator, clusterResource, lhs, rhs));
Assert.assertEquals(
"Greater Than Or Equal To operation is wrongly calculated.",
greaterThanOrEqual, Resources.greaterThanOrEqual(resourceCalculator,
clusterResource, lhs, rhs));
Assert.assertEquals("Max(value) Operation wrongly calculated.", max,
Resources.max(resourceCalculator, clusterResource, lhs, rhs));
Assert.assertEquals("Min(value) operation is wrongly calculated.", min,
Resources.min(resourceCalculator, clusterResource, lhs, rhs));
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
if (Resources.lessThan(resourceCalculator, clusterResource,
node.getAvailableResource(), minimumAllocation)) {
break;
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common
private void assertResourcesOperations(Resource clusterResource,
Resource lhs, Resource rhs, boolean lessThan, boolean lessThanOrEqual,
boolean greaterThan, boolean greaterThanOrEqual, Resource max,
Resource min) {
assertEquals("Less Than operation is wrongly calculated.", lessThan,
Resources.lessThan(resourceCalculator, clusterResource, lhs, rhs));
assertEquals(
"Less Than Or Equal To operation is wrongly calculated.",
lessThanOrEqual, Resources.lessThanOrEqual(resourceCalculator,
clusterResource, lhs, rhs));
assertEquals("Greater Than operation is wrongly calculated.",
greaterThan,
Resources.greaterThan(resourceCalculator, clusterResource, lhs, rhs));
assertEquals(
"Greater Than Or Equal To operation is wrongly calculated.",
greaterThanOrEqual, Resources.greaterThanOrEqual(resourceCalculator,
clusterResource, lhs, rhs));
assertEquals("Max(value) Operation wrongly calculated.", max,
Resources.max(resourceCalculator, clusterResource, lhs, rhs));
assertEquals("Min(value) operation is wrongly calculated.", min,
Resources.min(resourceCalculator, clusterResource, lhs, rhs));
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
private boolean isStarved(Resource share) {
Resource desiredShare = Resources.min(scheduler.getResourceCalculator(),
scheduler.getClusterResource(), share, getDemand());
return Resources.lessThan(scheduler.getResourceCalculator(),
scheduler.getClusterResource(), getResourceUsage(), desiredShare);
}
}
代码示例来源:origin: io.hops/hadoop-yarn-common
private void assertResourcesOperations(Resource clusterResource,
Resource lhs, Resource rhs, boolean lessThan, boolean lessThanOrEqual,
boolean greaterThan, boolean greaterThanOrEqual, Resource max,
Resource min) {
Assert.assertEquals("Less Than operation is wrongly calculated.", lessThan,
Resources.lessThan(resourceCalculator, clusterResource, lhs, rhs));
Assert.assertEquals(
"Less Than Or Equal To operation is wrongly calculated.",
lessThanOrEqual, Resources.lessThanOrEqual(resourceCalculator,
clusterResource, lhs, rhs));
Assert.assertEquals("Greater Than operation is wrongly calculated.",
greaterThan,
Resources.greaterThan(resourceCalculator, clusterResource, lhs, rhs));
Assert.assertEquals(
"Greater Than Or Equal To operation is wrongly calculated.",
greaterThanOrEqual, Resources.greaterThanOrEqual(resourceCalculator,
clusterResource, lhs, rhs));
Assert.assertEquals("Max(value) Operation wrongly calculated.", max,
Resources.max(resourceCalculator, clusterResource, lhs, rhs));
Assert.assertEquals("Min(value) operation is wrongly calculated.", min,
Resources.min(resourceCalculator, clusterResource, lhs, rhs));
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
private boolean isStarved(Resource share) {
Resource desiredShare = Resources.min(scheduler.getResourceCalculator(),
scheduler.getClusterResource(), share, getDemand());
return Resources.lessThan(scheduler.getResourceCalculator(),
scheduler.getClusterResource(), getResourceUsage(), desiredShare);
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
if (Resources.lessThan(resourceCalculator, getClusterResource(),
node.getUnallocatedResource(), minimumAllocation)) {
break;
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
if (Resources.lessThan(resourceCalculator, clusterResource,
newTotalWithoutReservedResource, currentLimitResource)) {
if (LOG.isDebugEnabled()) {
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
if (Resources.lessThan(rc, tot_guarant, q.idealAssigned, curPlusPend)) {
orderedByNeed.add(q);
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
if (Resources.lessThan(rc, tot_guarant, q.idealAssigned, curPlusPend)) {
orderedByNeed.add(q);
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
List<RMContainer> cReserved = new ArrayList<RMContainer>();
Resource resIter = Resource.newInstance(0, 0);
for (; Resources.lessThan(rc, clusterResources, resIter, reserved); Resources
.addTo(resIter, gran)) {
cReserved.add(mockContainer(appAttId, cAlloc, unit,
Resource usedIter = Resource.newInstance(0, 0);
int i = 0;
for (; Resources.lessThan(rc, clusterResources, usedIter, used); Resources
.addTo(usedIter, gran)) {
if (setAMContainer && i == 0) {
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
private void setPreemptionAllowed(ResourceLimits limits, String nodePartition) {
// Set preemption-allowed:
// For leaf queue, only under-utilized queue is allowed to preempt resources from other queues
if (!queueResourceQuotas.getEffectiveMinResource(nodePartition)
.equals(Resources.none())) {
limits.setIsAllowPreemption(Resources.lessThan(resourceCalculator,
csContext.getClusterResource(), queueUsage.getUsed(nodePartition),
queueResourceQuotas.getEffectiveMinResource(nodePartition)));
return;
}
float usedCapacity = queueCapacities.getAbsoluteUsedCapacity(nodePartition);
float guaranteedCapacity = queueCapacities.getAbsoluteCapacity(nodePartition);
limits.setIsAllowPreemption(usedCapacity < guaranteedCapacity);
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
@Override
public int compare(TempAppPerPartition ta1, TempAppPerPartition ta2) {
if (ta1.getUser().equals(ta2.getUser())) {
AbstractComparatorOrderingPolicy<FiCaSchedulerApp> acop =
(AbstractComparatorOrderingPolicy<FiCaSchedulerApp>)
ta1.getFiCaSchedulerApp().getCSLeafQueue().getOrderingPolicy();
return acop.getComparator()
.compare(ta1.getFiCaSchedulerApp(), ta2.getFiCaSchedulerApp());
} else {
Resource usedByUser1 = ta1.getTempUserPerPartition().getUsedDeductAM();
Resource usedByUser2 = ta2.getTempUserPerPartition().getUsedDeductAM();
if (Resources.equals(usedByUser1, usedByUser2)) {
return ta1.getApplicationId().compareTo(ta2.getApplicationId());
}
if (Resources.lessThan(rc, clusterRes, usedByUser1, usedByUser2)) {
return -1;
} else {
return 1;
}
}
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
if (Resources.lessThan(resourceCalculator, clusterResource,
queueResourceQuotas.getEffectiveMaxResource(nodePartition),
queueUsage.getUsed(nodePartition))) {
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
List<RMContainer> cReserved = new ArrayList<RMContainer>();
Resource resIter = Resource.newInstance(0, 0);
for (; Resources.lessThan(rc, clusterResources, resIter, reserved); Resources
.addTo(resIter, gran)) {
cReserved.add(mockContainer(appAttId, cAlloc, unit,
Resource usedIter = Resource.newInstance(0, 0);
int i = 0;
for (; Resources.lessThan(rc, clusterResources, usedIter, used); Resources
.addTo(usedIter, gran)) {
if (setAMContainer && i == 0) {
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
Resource minShare2 = Resources.min(RESOURCE_CALCULATOR, null,
s2.getMinShare(), s2.getDemand());
boolean s1Needy = Resources.lessThan(RESOURCE_CALCULATOR, null,
s1.getResourceUsage(), minShare1);
boolean s2Needy = Resources.lessThan(RESOURCE_CALCULATOR, null,
s2.getResourceUsage(), minShare2);
minShareRatio1 = (double) s1.getResourceUsage().getMemory()
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
Resource minShare2 = Resources.min(RESOURCE_CALCULATOR, null,
s2.getMinShare(), s2.getDemand());
boolean s1Needy = Resources.lessThan(RESOURCE_CALCULATOR, null,
s1.getResourceUsage(), minShare1);
boolean s2Needy = Resources.lessThan(RESOURCE_CALCULATOR, null,
s2.getResourceUsage(), minShare2);
minShareRatio1 = (double) s1.getResourceUsage().getMemory()
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
if (Resources.lessThan(rc, totalPartitionResource, extra,
Resources.none())) {
extra = Resources.none();
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
ResourceCalculator rc = this.csContext.getResourceCalculator();
if (getQueueName().equals("root")) {
if (!resourceByLabel.equals(Resources.none()) && Resources.lessThan(rc,
clusterResource, resourceByLabel, configuredMinResources)) {
numeratorForMinRatio = resourceByLabel;
if (Resources.lessThan(rc, clusterResource,
queueResourceQuotas.getEffectiveMinResource(label),
configuredMinResources)) {
内容来源于网络,如有侵权,请联系作者删除!