Class LoadBasedRouterPolicy
java.lang.Object
org.apache.hadoop.yarn.server.federation.policies.AbstractConfigurableFederationPolicy
org.apache.hadoop.yarn.server.federation.policies.router.AbstractRouterPolicy
org.apache.hadoop.yarn.server.federation.policies.router.LoadBasedRouterPolicy
- All Implemented Interfaces:
ConfigurableFederationPolicy,FederationRouterPolicy
This implements a simple load-balancing policy. The policy "weights" are
binary 0/1 values that enable/disable each sub-cluster, and the policy peaks
the sub-cluster with the least load to forward this application.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SubClusterIdchooseSubCluster(String queue, Map<SubClusterId, SubClusterInfo> preSelectSubclusters) This method is implemented by the specific policy, and it is used to route both reservations, and applications among a given set of sub-clusters.voidreinitialize(FederationPolicyInitializationContext policyContext) This method is invoked to initialize of update the configuration of policies.Methods inherited from class org.apache.hadoop.yarn.server.federation.policies.router.AbstractRouterPolicy
getHomeSubcluster, getReservationHomeSubcluster, prefilterSubClusters, validate, validateMethods inherited from class org.apache.hadoop.yarn.server.federation.policies.AbstractConfigurableFederationPolicy
getActiveSubclusters, getIsDirty, getPolicyContext, getPolicyInfo, setPolicyContext, setPolicyInfo
-
Constructor Details
-
LoadBasedRouterPolicy
public LoadBasedRouterPolicy()
-
-
Method Details
-
reinitialize
public void reinitialize(FederationPolicyInitializationContext policyContext) throws FederationPolicyInitializationException Description copied from interface:ConfigurableFederationPolicyThis method is invoked to initialize of update the configuration of policies. The implementor should provide try-n-swap semantics, and retain state if possible.- Specified by:
reinitializein interfaceConfigurableFederationPolicy- Overrides:
reinitializein classAbstractConfigurableFederationPolicy- Parameters:
policyContext- the new context to provide to implementor.- Throws:
FederationPolicyInitializationException- in case the initialization fails.
-
chooseSubCluster
protected SubClusterId chooseSubCluster(String queue, Map<SubClusterId, SubClusterInfo> preSelectSubclusters) throws org.apache.hadoop.yarn.exceptions.YarnExceptionDescription copied from class:AbstractRouterPolicyThis method is implemented by the specific policy, and it is used to route both reservations, and applications among a given set of sub-clusters.- Specified by:
chooseSubClusterin classAbstractRouterPolicy- Parameters:
queue- the queue for this application/reservationpreSelectSubclusters- a pre-filter set of sub-clusters- Returns:
- the chosen sub-cluster
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if the policy fails to choose a sub-cluster
-