Class LoadBasedGlobalPolicy
java.lang.Object
org.apache.hadoop.yarn.server.globalpolicygenerator.policygenerator.GlobalPolicy
org.apache.hadoop.yarn.server.globalpolicygenerator.policygenerator.LoadBasedGlobalPolicy
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
Load based policy that generates weighted policies by scaling
the cluster load (based on pending) to a weight from 0.0 to 1.0.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId,org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo> getSubClustersMetricsInfo(Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId, Map<Class, Object>> subClusterMetricsInfo) Get the ClusterMetric information of the subCluster.getTargetWeights(Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId, org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo> clusterMetrics) Get subCluster target weight.protected floatgetWeightByScaling(int maxPendingVal, int curPendingVal) Get weight information.protected org.apache.hadoop.yarn.server.federation.policies.manager.WeightedLocalityPolicyManagergetWeightedLocalityPolicyManager(String queue, Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId, Map<Class, Object>> subClusterMetricInfos) GPG can help update the policy of the queue.Return a map of the object type and RM path to request it from - the framework will query these paths and provide the objects to the policy.voidsetConf(org.apache.hadoop.conf.Configuration conf) protected org.apache.hadoop.yarn.server.federation.policies.manager.FederationPolicyManagerupdatePolicy(String queueName, Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId, Map<Class, Object>> clusterInfo, org.apache.hadoop.yarn.server.federation.policies.manager.FederationPolicyManager currentManager) Update the policy of the queue.Methods inherited from class org.apache.hadoop.yarn.server.globalpolicygenerator.policygenerator.GlobalPolicy
getConf
-
Constructor Details
-
LoadBasedGlobalPolicy
public LoadBasedGlobalPolicy()
-
-
Method Details
-
setConf
public void setConf(org.apache.hadoop.conf.Configuration conf) - Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable- Overrides:
setConfin classGlobalPolicy
-
registerPaths
Description copied from class:GlobalPolicyReturn a map of the object type and RM path to request it from - the framework will query these paths and provide the objects to the policy. Delegating this responsibility to the PolicyGenerator enables us to avoid duplicate calls to the same * endpoints as the GlobalPolicy is invoked once per queue.- Overrides:
registerPathsin classGlobalPolicy- Returns:
- a map of the object type and RM path.
-
updatePolicy
protected org.apache.hadoop.yarn.server.federation.policies.manager.FederationPolicyManager updatePolicy(String queueName, Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId, Map<Class, Object>> clusterInfo, org.apache.hadoop.yarn.server.federation.policies.manager.FederationPolicyManager currentManager) Update the policy of the queue.- Specified by:
updatePolicyin classGlobalPolicy- Parameters:
queueName- name of the queueclusterInfo- subClusterId map to cluster information about the SubCluster used to make policy decisionscurrentManager- the FederationPolicyManager for the queue's existing policy the manager may be null, in which case the policy will need to be created.- Returns:
- FederationPolicyManager.
-
getWeightedLocalityPolicyManager
protected org.apache.hadoop.yarn.server.federation.policies.manager.WeightedLocalityPolicyManager getWeightedLocalityPolicyManager(String queue, Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId, Map<Class, Object>> subClusterMetricInfos) GPG can help update the policy of the queue. We automatically generate the weight of the subCluster according to the clusterMetrics of the subCluster.- Parameters:
queue- queueName.subClusterMetricInfos- Metric information of the subCluster.- Returns:
- WeightedLocalityPolicyManager.
-
getSubClustersMetricsInfo
protected Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId,org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo> getSubClustersMetricsInfo(Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId, Map<Class, Object>> subClusterMetricsInfo) Get the ClusterMetric information of the subCluster.- Parameters:
subClusterMetricsInfo- subCluster Metric Information.- Returns:
- Mapping relationship between subCluster and Metric.
-
getTargetWeights
@VisibleForTesting protected Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterIdInfo,Float> getTargetWeights(Map<org.apache.hadoop.yarn.server.federation.store.records.SubClusterId, org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo> clusterMetrics) Get subCluster target weight.- Parameters:
clusterMetrics- Metric of the subCluster.- Returns:
- subCluster Weights.
-
getWeightByScaling
protected float getWeightByScaling(int maxPendingVal, int curPendingVal) Get weight information. We will calculate the weight information according to different Scaling. NONE: No calculation is required, and the weight is 1 at this time. LINEAR: For linear computation, we will use (maxPendingVal - curPendingVal) / (maxPendingVal). QUADRATIC: Calculated using quadratic, We will calculate quadratic for maxPendingVal, curPendingVal, then use this formula = (maxPendingVal - curPendingVal) / (maxPendingVal). LOG(LOGARITHM): Calculated using logarithm, We will calculate logarithm for maxPendingVal, curPendingVal, then use this formula = (maxPendingVal - curPendingVal) / (maxPendingVal).- Parameters:
maxPendingVal- maxPending - minPendingcurPendingVal- pending - minPending- Returns:
- Calculated weight information.
-