Class WeightedPolicyInfo

java.lang.Object
org.apache.hadoop.yarn.server.federation.policies.dao.WeightedPolicyInfo

@Private @Evolving public class WeightedPolicyInfo extends Object
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 Details

    • WeightedPolicyInfo

      public WeightedPolicyInfo()
  • Method Details

    • fromByteBuffer

      public static WeightedPolicyInfo fromByteBuffer(ByteBuffer bb) throws FederationPolicyInitializationException
      Deserializes a WeightedPolicyInfo from a byte UTF-8 JSON representation.
      Parameters:
      bb - the input byte representation.
      Returns:
      the WeightedPolicyInfo represented.
      Throws:
      FederationPolicyInitializationException - if a deserialization error occurs.
    • getRouterPolicyWeights

      public Map<SubClusterIdInfo,Float> getRouterPolicyWeights()
      Getter of the router weights.
      Returns:
      the router weights.
    • setRouterPolicyWeights

      public void setRouterPolicyWeights(Map<SubClusterIdInfo,Float> policyWeights)
      Setter method for Router weights.
      Parameters:
      policyWeights - the router weights.
    • getAMRMPolicyWeights

      public Map<SubClusterIdInfo,Float> getAMRMPolicyWeights()
      Getter for AMRMProxy weights.
      Returns:
      the AMRMProxy weights.
    • setAMRMPolicyWeights

      public void setAMRMPolicyWeights(Map<SubClusterIdInfo,Float> policyWeights)
      Setter method for ARMRMProxy weights.
      Parameters:
      policyWeights - the amrmproxy weights.
    • toByteBuffer

      Converts the policy into a byte array representation in the input ByteBuffer.
      Returns:
      byte array representation of this policy configuration.
      Throws:
      FederationPolicyInitializationException - if a serialization error occurs.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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

      public String toString()
      Overrides:
      toString in class Object