Class HashBasedRouterPolicy
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.HashBasedRouterPolicy
- All Implemented Interfaces:
ConfigurableFederationPolicy,FederationRouterPolicy
This
FederationRouterPolicy pick a subcluster based on the hash of
the job's queue name. Useful to provide a default behavior when too many
queues exist in a system. This also ensures that all jobs belonging to a
queue are mapped to the same sub-cluster (likely help with locality).-
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 federationPolicyContext) 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
-
HashBasedRouterPolicy
public HashBasedRouterPolicy()
-
-
Method Details
-
reinitialize
public void reinitialize(FederationPolicyInitializationContext federationPolicyContext) 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:
federationPolicyContext- 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
-