@InterfaceAudience.Private @InterfaceStability.Unstable public abstract class ResourceCalculator extends Object
Resource
comparison and manipulation interfaces.Constructor and Description |
---|
ResourceCalculator() |
Modifier and Type | Method and Description |
---|---|
abstract int |
compare(Resource clusterResource,
Resource lhs,
Resource rhs) |
abstract int |
computeAvailableContainers(Resource available,
Resource required)
Compute the number of containers which can be allocated given
available and required resources. |
abstract float |
divide(Resource clusterResource,
Resource numerator,
Resource denominator)
Divide resource
numerator by resource denominator
using specified policy (domination, average, fairness etc.); hence overall
clusterResource is provided for context. |
static int |
divideAndCeil(int a,
int b) |
abstract Resource |
divideAndCeil(Resource numerator,
int denominator)
Divide-and-ceil
numerator by denominator . |
abstract Resource |
multiplyAndNormalizeDown(Resource r,
double by,
Resource stepFactor)
Multiply resource
r by factor by
and normalize down using step-factor stepFactor . |
abstract Resource |
multiplyAndNormalizeUp(Resource r,
double by,
Resource stepFactor)
Multiply resource
r by factor by
and normalize up using step-factor stepFactor . |
Resource |
normalize(Resource r,
Resource minimumResource,
Resource maximumResource)
Normalize resource
r given the base
minimumResource and verify against max allowed
maximumResource |
abstract Resource |
normalize(Resource r,
Resource minimumResource,
Resource maximumResource,
Resource stepFactor)
Normalize resource
r given the base
minimumResource and verify against max allowed
maximumResource using a step factor for hte normalization. |
abstract float |
ratio(Resource a,
Resource b)
Ratio of resource
a to resource b . |
static int |
roundDown(int a,
int b) |
abstract Resource |
roundDown(Resource r,
Resource stepFactor)
Round-down resource
r given factor stepFactor . |
static int |
roundUp(int a,
int b) |
abstract Resource |
roundUp(Resource r,
Resource stepFactor)
Round-up resource
r given factor stepFactor . |
public static int divideAndCeil(int a, int b)
public static int roundUp(int a, int b)
public static int roundDown(int a, int b)
public abstract int computeAvailableContainers(Resource available, Resource required)
available
and required
resources.available
- available resourcesrequired
- required resourcespublic abstract Resource multiplyAndNormalizeUp(Resource r, double by, Resource stepFactor)
r
by factor by
and normalize up using step-factor stepFactor
.r
- resource to be multipliedby
- multiplierstepFactor
- factor by which to normalize uppublic abstract Resource multiplyAndNormalizeDown(Resource r, double by, Resource stepFactor)
r
by factor by
and normalize down using step-factor stepFactor
.r
- resource to be multipliedby
- multiplierstepFactor
- factor by which to normalize downpublic Resource normalize(Resource r, Resource minimumResource, Resource maximumResource)
r
given the base
minimumResource
and verify against max allowed
maximumResource
r
- resourceminimumResource
- step-factormaximumResource
- the upper bound of the resource to be allocatedpublic abstract Resource normalize(Resource r, Resource minimumResource, Resource maximumResource, Resource stepFactor)
r
given the base
minimumResource
and verify against max allowed
maximumResource
using a step factor for hte normalization.r
- resourceminimumResource
- minimum valuemaximumResource
- the upper bound of the resource to be allocatedstepFactor
- the increment for resources to be allocatedpublic abstract Resource roundUp(Resource r, Resource stepFactor)
r
given factor stepFactor
.r
- resourcestepFactor
- step-factorpublic abstract Resource roundDown(Resource r, Resource stepFactor)
r
given factor stepFactor
.r
- resourcestepFactor
- step-factorpublic abstract float divide(Resource clusterResource, Resource numerator, Resource denominator)
numerator
by resource denominator
using specified policy (domination, average, fairness etc.); hence overall
clusterResource
is provided for context.clusterResource
- cluster resourcesnumerator
- numeratordenominator
- denominatornumerator
/denominator
using specific policypublic abstract float ratio(Resource a, Resource b)
a
to resource b
.a
- resourceb
- resourcea
to resource b
Copyright © 2013 Apache Software Foundation. All rights reserved.