@InterfaceAudience.Private public final class FederationPolicyUtils extends Object
| Modifier and Type | Field and Description | 
|---|---|
| static String | NO_ACTIVE_SUBCLUSTER_AVAILABLE | 
| Modifier and Type | Method and Description | 
|---|---|
| static int | getWeightedRandom(ArrayList<Float> weights)Select a random bin according to the weight array for the bins. | 
| static FederationPolicyManager | instantiatePolicyManager(String newType)A utilize method to instantiate a policy manager class given the type
 (class name) from  SubClusterPolicyConfiguration. | 
| static FederationAMRMProxyPolicy | loadAMRMPolicy(String queue,
              FederationAMRMProxyPolicy oldPolicy,
              org.apache.hadoop.conf.Configuration conf,
              FederationStateStoreFacade federationFacade,
              SubClusterId homeSubClusterId)Get AMRMProxy policy from state store, using default queue and
 configuration as fallback. | 
| static SubClusterPolicyConfiguration | loadPolicyConfiguration(String queue,
                       org.apache.hadoop.conf.Configuration conf,
                       FederationStateStoreFacade federationFacade)Get Federation policy configuration from state store, using default queue
 and configuration as fallback. | 
| static void | setRand(long seed) | 
| static void | validateSubClusterAvailability(List<SubClusterId> activeSubClusters,
                              List<SubClusterId> blackListSubClusters)Validate if there is any active subcluster that is not blacklisted, it will
 throw an exception if there are no usable subclusters. | 
public static final String NO_ACTIVE_SUBCLUSTER_AVAILABLE
public static FederationPolicyManager instantiatePolicyManager(String newType) throws FederationPolicyInitializationException
SubClusterPolicyConfiguration.newType - class name of the policy manager to createFederationPolicyInitializationException - if failspublic static SubClusterPolicyConfiguration loadPolicyConfiguration(String queue, org.apache.hadoop.conf.Configuration conf, FederationStateStoreFacade federationFacade)
queue - the queue of the applicationconf - the YARN configurationfederationFacade - state store facadepublic static FederationAMRMProxyPolicy loadAMRMPolicy(String queue, FederationAMRMProxyPolicy oldPolicy, org.apache.hadoop.conf.Configuration conf, FederationStateStoreFacade federationFacade, SubClusterId homeSubClusterId) throws FederationPolicyInitializationException
queue - the queue of the applicationoldPolicy - the previous policy instance (can be null)conf - the YARN configurationfederationFacade - state store facadehomeSubClusterId - home sub-cluster idFederationPolicyInitializationException - if failspublic static void validateSubClusterAvailability(List<SubClusterId> activeSubClusters, List<SubClusterId> blackListSubClusters) throws FederationPolicyException
activeSubClusters - the list of subClusters as identified by
          SubClusterId currently active.blackListSubClusters - the list of subClusters as identified by
          SubClusterId to blackList from the selection of the home
          subCluster.FederationPolicyException - if there are no usable subclusters.public static int getWeightedRandom(ArrayList<Float> weights)
weights - the weight arraypublic static void setRand(long seed)
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.