public class ConstraintSolverStrategy extends BaseResourceAwareStrategy
Modifier and Type | Class and Description |
---|---|
static class |
ConstraintSolverStrategy.ConstraintConfig
Component constraint as derived from configuration.
|
protected static class |
ConstraintSolverStrategy.SearcherState |
protected static class |
ConstraintSolverStrategy.SolverResult |
BaseResourceAwareStrategy.AllResources, BaseResourceAwareStrategy.ExistingScheduleFunc, BaseResourceAwareStrategy.ObjectResources
Modifier and Type | Field and Description |
---|---|
static String |
CONSTRAINT_TYPE_INCOMPATIBLE_COMPONENTS |
static String |
CONSTRAINT_TYPE_MAX_NODE_CO_LOCATION_CNT |
cluster
Constructor and Description |
---|
ConstraintSolverStrategy() |
Modifier and Type | Method and Description |
---|---|
protected ConstraintSolverStrategy.SolverResult |
backtrackSearch(ConstraintSolverStrategy.SearcherState state)
Try to schedule till successful or till limits (backtrack count or time) have been exceeded.
|
boolean |
isExecAssignmentToWorkerValid(WorkerSlot worker,
ConstraintSolverStrategy.SearcherState state)
Check if any constraints are violated if exec is scheduled on worker.
|
SchedulingResult |
schedule(Cluster cluster,
TopologyDetails td)
This method is invoked to calculate a scheduling for topology td.
|
<K extends Comparable<K>,V extends Comparable<V>> |
sortByValues(Map<K,V> map)
Used to sort a Map by the values - higher values up front.
|
protected TreeSet<BaseResourceAwareStrategy.ObjectResources> |
sortObjectResources(BaseResourceAwareStrategy.AllResources allResources,
ExecutorDetails exec,
TopologyDetails topologyDetails,
BaseResourceAwareStrategy.ExistingScheduleFunc existingScheduleFunc) |
static boolean |
validateSolution(Cluster cluster,
TopologyDetails td,
ConstraintSolverStrategy.ConstraintConfig constraintConfig)
Determines if a scheduling is valid and all constraints are satisfied.
|
findWorkerForExec, getSpouts, hostnameToNodes, idToNode, makeHostToNodeIds, mkNotEnoughResources, nodeToRack, orderExecutors, prepare, scheduleExecutor, sortAllNodes, sortNodes
public static final String CONSTRAINT_TYPE_MAX_NODE_CO_LOCATION_CNT
public static final String CONSTRAINT_TYPE_INCOMPATIBLE_COMPONENTS
public static boolean validateSolution(Cluster cluster, TopologyDetails td, ConstraintSolverStrategy.ConstraintConfig constraintConfig)
Determines if a scheduling is valid and all constraints are satisfied.
public SchedulingResult schedule(Cluster cluster, TopologyDetails td)
IStrategy
This method is invoked to calculate a scheduling for topology td. Cluster will reject any changes that are not for the given topology. Any changes made to the cluster will be committed if the scheduling is successful.
NOTE: scheduling occurs as a runnable in an interruptible thread. Scheduling should consider being interrupted if long running.cluster
- the current state of the clustertd
- the topology to schedule forprotected TreeSet<BaseResourceAwareStrategy.ObjectResources> sortObjectResources(BaseResourceAwareStrategy.AllResources allResources, ExecutorDetails exec, TopologyDetails topologyDetails, BaseResourceAwareStrategy.ExistingScheduleFunc existingScheduleFunc)
sortObjectResources
in class BaseResourceAwareStrategy
protected ConstraintSolverStrategy.SolverResult backtrackSearch(ConstraintSolverStrategy.SearcherState state)
Try to schedule till successful or till limits (backtrack count or time) have been exceeded.
state
- terminal state of the executor assignment.public boolean isExecAssignmentToWorkerValid(WorkerSlot worker, ConstraintSolverStrategy.SearcherState state)
Check if any constraints are violated if exec is scheduled on worker.
public <K extends Comparable<K>,V extends Comparable<V>> NavigableMap<K,V> sortByValues(Map<K,V> map)
Used to sort a Map by the values - higher values up front.
Copyright © 2020 The Apache Software Foundation. All rights reserved.