Class LocalityRouterPolicy
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.WeightedRandomRouterPolicy
org.apache.hadoop.yarn.server.federation.policies.router.LocalityRouterPolicy
- All Implemented Interfaces:
ConfigurableFederationPolicy,FederationRouterPolicy
This policy selects the subcluster depending on the node where the Client
wants to run its application.
It succeeds if:
- There are three AMContainerResourceRequests in the order
NODE, RACK, ANY
It falls back to WeightedRandomRouterPolicy in case of:
- Null or empty AMContainerResourceRequests;
- One AMContainerResourceRequests and it has ANY as ResourceName;
- The node is in blacklisted SubClusters.
It fails if:
- The node does not exist and RelaxLocality is False;
- We have an invalid number (not 0, 1 or 3) resource requests
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetHomeSubcluster(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appSubmissionContext, List<SubClusterId> blackListSubClusters) Simply picks from alphabetically-sorted active subclusters based on the hash of query name.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.WeightedRandomRouterPolicy
chooseSubClusterMethods inherited from class org.apache.hadoop.yarn.server.federation.policies.router.AbstractRouterPolicy
getReservationHomeSubcluster, prefilterSubClusters, validate, validateMethods inherited from class org.apache.hadoop.yarn.server.federation.policies.AbstractConfigurableFederationPolicy
getActiveSubclusters, getIsDirty, getPolicyContext, getPolicyInfo, setPolicyContext, setPolicyInfo
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
LocalityRouterPolicy
public LocalityRouterPolicy()
-
-
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.
-
getHomeSubcluster
public SubClusterId getHomeSubcluster(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appSubmissionContext, List<SubClusterId> blackListSubClusters) throws org.apache.hadoop.yarn.exceptions.YarnException Description copied from class:AbstractRouterPolicySimply picks from alphabetically-sorted active subclusters based on the hash of query name. Jobs of the same queue will all be routed to the same sub-cluster, as far as the number of active sub-cluster and their names remain the same.- Specified by:
getHomeSubclusterin interfaceFederationRouterPolicy- Overrides:
getHomeSubclusterin classAbstractRouterPolicy- Parameters:
appSubmissionContext- theApplicationSubmissionContextthat has to be routed to an appropriate subCluster for execution.blackListSubClusters- the list of subClusters as identified bySubClusterIdto blackList from the selection of the home subCluster.- Returns:
- a hash-based chosen
SubClusterIdthat will be the "home" for this application. - Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if there are no active subclusters.
-