Class UniformRandomRouterPolicy
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.UniformRandomRouterPolicy
- All Implemented Interfaces:
ConfigurableFederationPolicy,FederationRouterPolicy
This simple policy picks at uniform random among any of the currently active
subclusters. This policy is easy to use and good for testing.
NOTE: this is "almost" subsumed by the
WeightedRandomRouterPolicy.
Behavior only diverges when there are active sub-clusters that are not part
of the "weights", in which case the UniformRandomRouterPolicy send
load to them, while WeightedRandomRouterPolicy does not.-
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
-
UniformRandomRouterPolicy
public UniformRandomRouterPolicy()
-
-
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
-