public abstract class AbstractRouterPolicy extends AbstractConfigurableFederationPolicy implements FederationRouterPolicy
FederationRouterPolicy
implementations, that
provides common validation for reinitialization.Constructor and Description |
---|
AbstractRouterPolicy() |
Modifier and Type | Method and Description |
---|---|
protected abstract SubClusterId |
chooseSubCluster(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.
|
SubClusterId |
getHomeSubcluster(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appContext,
List<SubClusterId> blackLists)
Simply picks from alphabetically-sorted active subclusters based on the
hash of query name.
|
SubClusterId |
getReservationHomeSubcluster(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest request)
This method provides a wrapper of all policy functionalities for routing a
reservation.
|
protected Map<SubClusterId,SubClusterInfo> |
prefilterSubClusters(org.apache.hadoop.yarn.api.records.ReservationId reservationId,
Map<SubClusterId,SubClusterInfo> activeSubClusters)
Filter chosen SubCluster based on reservationId.
|
void |
validate(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appSubmissionContext) |
void |
validate(WeightedPolicyInfo newPolicyInfo)
Overridable validation step for the policy configuration.
|
getActiveSubclusters, getIsDirty, getPolicyContext, getPolicyInfo, reinitialize, setPolicyContext, setPolicyInfo
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
reinitialize
public void validate(WeightedPolicyInfo newPolicyInfo) throws FederationPolicyInitializationException
AbstractConfigurableFederationPolicy
validate
in class AbstractConfigurableFederationPolicy
newPolicyInfo
- the configuration to test.FederationPolicyInitializationException
- if the configuration is not
valid.public void validate(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appSubmissionContext) throws FederationPolicyException
FederationPolicyException
protected abstract SubClusterId chooseSubCluster(String queue, Map<SubClusterId,SubClusterInfo> preSelectSubClusters) throws org.apache.hadoop.yarn.exceptions.YarnException
queue
- the queue for this application/reservationpreSelectSubClusters
- a pre-filter set of sub-clustersorg.apache.hadoop.yarn.exceptions.YarnException
- if the policy fails to choose a sub-clusterprotected Map<SubClusterId,SubClusterInfo> prefilterSubClusters(org.apache.hadoop.yarn.api.records.ReservationId reservationId, Map<SubClusterId,SubClusterInfo> activeSubClusters) throws org.apache.hadoop.yarn.exceptions.YarnException
reservationId
- the globally unique identifier for a reservation.activeSubClusters
- the map of ids to info for all active subclusters.org.apache.hadoop.yarn.exceptions.YarnException
- if the policy fails to choose a sub-clusterpublic SubClusterId getHomeSubcluster(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appContext, List<SubClusterId> blackLists) throws org.apache.hadoop.yarn.exceptions.YarnException
getHomeSubcluster
in interface FederationRouterPolicy
appContext
- the ApplicationSubmissionContext
that
has to be routed to an appropriate subCluster for execution.blackLists
- the list of subClusters as identified by
SubClusterId
to blackList from the selection of the home
subCluster.SubClusterId
that will be the "home"
for this application.org.apache.hadoop.yarn.exceptions.YarnException
- if there are no active subclusters.public SubClusterId getReservationHomeSubcluster(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest request) throws org.apache.hadoop.yarn.exceptions.YarnException
getReservationHomeSubcluster
in interface FederationRouterPolicy
request
- the reservation to route.org.apache.hadoop.yarn.exceptions.YarnException
- if there are issues initializing policies, or no
valid sub-cluster id could be found for this reservation.Copyright © 2008–2024 Apache Software Foundation. All rights reserved.