Class AbstractConfigurableFederationPolicy
java.lang.Object
org.apache.hadoop.yarn.server.federation.policies.AbstractConfigurableFederationPolicy
- All Implemented Interfaces:
ConfigurableFederationPolicy
- Direct Known Subclasses:
AbstractAMRMProxyPolicy,AbstractRouterPolicy
public abstract class AbstractConfigurableFederationPolicy
extends Object
implements ConfigurableFederationPolicy
Base abstract class for a weighted
ConfigurableFederationPolicy.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Map<SubClusterId,SubClusterInfo> This methods gets active subclusters map from theFederationStateStoreFacadeand validate it not being null/empty.booleanReturns true whether the last reinitialization requires actual changes, or was "free" as the weights have not changed.Getter method for theFederationPolicyInitializationContext.Getter method for the configuration weights.voidreinitialize(FederationPolicyInitializationContext initializationContext) This method is invoked to initialize of update the configuration of policies.voidsetPolicyContext(FederationPolicyInitializationContext policyContext) Setter method for theFederationPolicyInitializationContext.voidsetPolicyInfo(WeightedPolicyInfo policyInfo) Setter method for the configuration weights.voidvalidate(WeightedPolicyInfo newPolicyInfo) Overridable validation step for the policy configuration.
-
Constructor Details
-
AbstractConfigurableFederationPolicy
public AbstractConfigurableFederationPolicy()
-
-
Method Details
-
reinitialize
public void reinitialize(FederationPolicyInitializationContext initializationContext) 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- Parameters:
initializationContext- the new context to provide to implementor.- Throws:
FederationPolicyInitializationException- in case the initialization fails.
-
validate
public void validate(WeightedPolicyInfo newPolicyInfo) throws FederationPolicyInitializationException Overridable validation step for the policy configuration.- Parameters:
newPolicyInfo- the configuration to test.- Throws:
FederationPolicyInitializationException- if the configuration is not valid.
-
getIsDirty
public boolean getIsDirty()Returns true whether the last reinitialization requires actual changes, or was "free" as the weights have not changed. This is used by subclasses overriding reinitialize and calling super.reinitialize() to know whether to quit early.- Returns:
- whether more work is needed to initialize.
-
getPolicyInfo
Getter method for the configuration weights.- Returns:
- the
WeightedPolicyInforepresenting the policy configuration.
-
setPolicyInfo
Setter method for the configuration weights.- Parameters:
policyInfo- theWeightedPolicyInforepresenting the policy configuration.
-
getPolicyContext
Getter method for theFederationPolicyInitializationContext.- Returns:
- the context for this policy.
-
setPolicyContext
Setter method for theFederationPolicyInitializationContext.- Parameters:
policyContext- the context to assign to this policy.
-
getActiveSubclusters
protected Map<SubClusterId,SubClusterInfo> getActiveSubclusters() throws org.apache.hadoop.yarn.exceptions.YarnExceptionThis methods gets active subclusters map from theFederationStateStoreFacadeand validate it not being null/empty.- Returns:
- the map of ids to info for all active subclusters.
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if we can't get the list.
-