Class WeightedPolicyInfo
java.lang.Object
org.apache.hadoop.yarn.server.federation.policies.dao.WeightedPolicyInfo
This is a DAO class for the configuration of parameters for federation
policies. This generalizes several possible configurations as two lists of
SubClusterIdInfo and corresponding weights as a Float. The
interpretation of the weight is left to the logic in the policy.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic WeightedPolicyInfoDeserializes aWeightedPolicyInfofrom a byte UTF-8 JSON representation.Getter for AMRMProxy weights.floatReturn the parameter headroomAlpha, used by policies that balance weight-based and load-based considerations in their decisions.Getter of the router weights.inthashCode()voidsetAMRMPolicyWeights(Map<SubClusterIdInfo, Float> policyWeights) Setter method for ARMRMProxy weights.voidsetHeadroomAlpha(float headroomAlpha) Set the parameter headroomAlpha, used by policies that balance weight-based and load-based considerations in their decisions.voidsetRouterPolicyWeights(Map<SubClusterIdInfo, Float> policyWeights) Setter method for Router weights.Converts the policy into a byte array representation in the inputByteBuffer.toString()
-
Constructor Details
-
WeightedPolicyInfo
public WeightedPolicyInfo()
-
-
Method Details
-
fromByteBuffer
public static WeightedPolicyInfo fromByteBuffer(ByteBuffer bb) throws FederationPolicyInitializationException Deserializes aWeightedPolicyInfofrom a byte UTF-8 JSON representation.- Parameters:
bb- the input byte representation.- Returns:
- the
WeightedPolicyInforepresented. - Throws:
FederationPolicyInitializationException- if a deserialization error occurs.
-
getRouterPolicyWeights
Getter of the router weights.- Returns:
- the router weights.
-
setRouterPolicyWeights
Setter method for Router weights.- Parameters:
policyWeights- the router weights.
-
getAMRMPolicyWeights
Getter for AMRMProxy weights.- Returns:
- the AMRMProxy weights.
-
setAMRMPolicyWeights
Setter method for ARMRMProxy weights.- Parameters:
policyWeights- the amrmproxy weights.
-
toByteBuffer
Converts the policy into a byte array representation in the inputByteBuffer.- Returns:
- byte array representation of this policy configuration.
- Throws:
FederationPolicyInitializationException- if a serialization error occurs.
-
equals
-
hashCode
public int hashCode() -
getHeadroomAlpha
public float getHeadroomAlpha()Return the parameter headroomAlpha, used by policies that balance weight-based and load-based considerations in their decisions. For policies that use this parameter, values close to 1 indicate that most of the decision should be based on currently observed headroom from various sub-clusters, values close to zero, indicate that the decision should be mostly based on weights and practically ignore current load.- Returns:
- the value of headroomAlpha.
-
setHeadroomAlpha
public void setHeadroomAlpha(float headroomAlpha) Set the parameter headroomAlpha, used by policies that balance weight-based and load-based considerations in their decisions. For policies that use this parameter, values close to 1 indicate that most of the decision should be based on currently observed headroom from various sub-clusters, values close to zero, indicate that the decision should be mostly based on weights and practically ignore current load.- Parameters:
headroomAlpha- the value to use for balancing.
-
toString
-