public class ConstraintSolverStrategy extends BaseResourceAwareStrategy
Modifier and Type | Class and Description |
---|---|
protected static class |
ConstraintSolverStrategy.SearcherState |
protected static class |
ConstraintSolverStrategy.SolverResult |
BaseResourceAwareStrategy.AllResources, BaseResourceAwareStrategy.ExistingScheduleFunc, BaseResourceAwareStrategy.ObjectResources
cluster
Constructor and Description |
---|
ConstraintSolverStrategy() |
findWorkerForExec, getSpouts, hostnameToNodes, idToNode, makeHostToNodeIds, mkNotEnoughResources, nodeToRack, orderExecutors, prepare, scheduleExecutor, sortAllNodes, sortNodes
public static boolean validateSolution(Cluster cluster, TopologyDetails td)
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)
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.
Copyright © 2019 The Apache Software Foundation. All rights reserved.