本文整理了Java中org.apache.hadoop.yarn.util.resource.Resources.multiply
方法的一些代码示例,展示了Resources.multiply
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resources.multiply
方法的具体详情如下:
包路径:org.apache.hadoop.yarn.util.resource.Resources
类名称:Resources
方法名:multiply
[英]Multiply rhs by by, and add the result to lhswithout creating any new Resource object
[中]将rhs乘以,并将结果添加到LHSWI,而不创建任何新的资源对象
代码示例来源: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: io.hops/hadoop-mapreduce-client-app
@Private
public Resource getResourceLimit() {
Resource headRoom = getAvailableResources();
Resource assignedMapResource =
Resources.multiply(mapResourceRequest, assignedRequests.maps.size());
Resource assignedReduceResource =
Resources.multiply(reduceResourceRequest,
assignedRequests.reduces.size());
return Resources.add(headRoom,
Resources.add(assignedMapResource, assignedReduceResource));
}
代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app
@Private
public Resource getResourceLimit() {
Resource headRoom = getAvailableResources();
Resource assignedMapResource =
Resources.multiply(mapResourceRequest, assignedRequests.maps.size());
Resource assignedReduceResource =
Resources.multiply(reduceResourceRequest,
assignedRequests.reduces.size());
return Resources.add(headRoom,
Resources.add(assignedMapResource, assignedReduceResource));
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-app
@Private
public Resource getResourceLimit() {
Resource headRoom = getAvailableResources();
Resource assignedMapResource =
Resources.multiply(mapResourceRequest, assignedRequests.maps.size());
Resource assignedReduceResource =
Resources.multiply(reduceResourceRequest,
assignedRequests.reduces.size());
return Resources.add(headRoom,
Resources.add(assignedMapResource, assignedReduceResource));
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
private void updateReservationThreshold() {
Resource newThreshold = Resources.multiply(
getIncrementResourceCapability(),
this.conf.getReservationThresholdIncrementMultiple());
reservationThreshold = newThreshold;
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
@Override
protected Resource getPlanResources(
Plan plan, Queue queue, Resource clusterResources) {
PlanQueue planQueue = (PlanQueue)queue;
float planAbsCap = planQueue.getAbsoluteCapacity();
Resource planResources = Resources.multiply(clusterResources, planAbsCap);
plan.setTotalCapacity(planResources);
return planResources;
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
@Override
protected Resource getPlanResources(
Plan plan, Queue queue, Resource clusterResources) {
PlanQueue planQueue = (PlanQueue)queue;
float planAbsCap = planQueue.getAbsoluteCapacity();
Resource planResources = Resources.multiply(clusterResources, planAbsCap);
plan.setTotalCapacity(planResources);
return planResources;
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
public static Resource toResource(ReservationRequest request) {
Resource resource = Resources.multiply(request.getCapability(),
(float) request.getNumContainers());
return resource;
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
@Override
protected Resource getPlanResources(
Plan plan, Queue queue, Resource clusterResources) {
PlanQueue planQueue = (PlanQueue)queue;
float planAbsCap = planQueue.getAbsoluteCapacity();
Resource planResources = Resources.multiply(clusterResources, planAbsCap);
plan.setTotalCapacity(planResources);
return planResources;
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
/**
* Is a queue being starved for its fair share threshold.
*/
@VisibleForTesting
boolean isStarvedForFairShare() {
return isStarved(
Resources.multiply(getFairShare(), getFairSharePreemptionThreshold()));
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
public Resource getGuaranteed() {
if(!effMinRes.equals(Resources.none())) {
return Resources.clone(effMinRes);
}
return Resources.multiply(totalPartitionResource, absCapacity);
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
public Resource getMax() {
if(!effMaxRes.equals(Resources.none())) {
return Resources.clone(effMaxRes);
}
return Resources.multiply(totalPartitionResource, absMaxCapacity);
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
public void assignPreemption(float scalingFactor,
ResourceCalculator rc, Resource clusterResource) {
if (Resources.greaterThan(rc, clusterResource, current, idealAssigned)) {
toBePreempted = Resources.multiply(
Resources.subtract(current, idealAssigned), scalingFactor);
} else {
toBePreempted = Resource.newInstance(0, 0);
}
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
public void assignPreemption(float scalingFactor,
ResourceCalculator rc, Resource clusterResource) {
if (Resources.greaterThan(rc, clusterResource, current, idealAssigned)) {
toBePreempted = Resources.multiply(
Resources.subtract(current, idealAssigned), scalingFactor);
} else {
toBePreempted = Resource.newInstance(0, 0);
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
@Override
protected Resource getReservationQueueResourceIfExists(Plan plan,
ReservationId reservationId) {
CSQueue resQueue = cs.getQueue(reservationId.toString());
Resource reservationResource = null;
if (resQueue != null) {
reservationResource = Resources.multiply(cs.getClusterResource(),
resQueue.getAbsoluteCapacity());
}
return reservationResource;
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
@Override
protected Resource getReservationQueueResourceIfExists(Plan plan,
ReservationId reservationId) {
CSQueue resQueue = cs.getQueue(reservationId.toString());
Resource reservationResource = null;
if (resQueue != null) {
reservationResource = Resources.multiply(cs.getClusterResource(),
resQueue.getAbsoluteCapacity());
}
return reservationResource;
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
@Override
protected Resource getReservationQueueResourceIfExists(Plan plan,
ReservationId reservationId) {
CSQueue resQueue = cs.getQueue(reservationId.toString());
Resource reservationResource = null;
if (resQueue != null) {
reservationResource = Resources.multiply(cs.getClusterResource(),
resQueue.getAbsoluteCapacity());
}
return reservationResource;
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager
public synchronized Resource getTotalPendingRequests() {
Resource ret = Resource.newInstance(0, 0);
for (ResourceRequest rr : appSchedulingInfo.getAllResourceRequests()) {
// to avoid double counting we count only "ANY" resource requests
if (ResourceRequest.isAnyLocation(rr.getResourceName())){
Resources.addTo(ret,
Resources.multiply(rr.getCapability(), rr.getNumContainers()));
}
}
return ret;
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
public synchronized Resource getTotalPendingRequests() {
Resource ret = Resource.newInstance(0, 0);
for (ResourceRequest rr : appSchedulingInfo.getAllResourceRequests()) {
// to avoid double counting we count only "ANY" resource requests
if (ResourceRequest.isAnyLocation(rr.getResourceName())){
Resources.addTo(ret,
Resources.multiply(rr.getCapability(), rr.getNumContainers()));
}
}
return ret;
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common
@Test
public void testMultiply() {
assertEquals(createResource(4, 2), multiply(createResource(2, 1), 2));
assertEquals(createResource(4, 2, 0), multiply(createResource(2, 1), 2));
assertEquals(createResource(2, 4), multiply(createResource(1, 2), 2));
assertEquals(createResource(2, 4, 0), multiply(createResource(1, 2), 2));
assertEquals(createResource(6, 6, 0), multiply(createResource(3, 3, 0), 2));
assertEquals(createResource(4, 4, 6), multiply(createResource(2, 2, 3), 2));
}
内容来源于网络,如有侵权,请联系作者删除!