Class ConstraintSolverStrategy
java.lang.Object
org.apache.storm.scheduler.resource.strategies.scheduling.BaseResourceAwareStrategy
org.apache.storm.scheduler.resource.strategies.scheduling.ConstraintSolverStrategy
- All Implemented Interfaces:
IStrategy
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.storm.scheduler.resource.strategies.scheduling.BaseResourceAwareStrategy
BaseResourceAwareStrategy.NodeSortType
-
Field Summary
Fields inherited from class org.apache.storm.scheduler.resource.strategies.scheduling.BaseResourceAwareStrategy
cluster, compToExecs, config, execSorter, execToComp, nodes, nodeSorter, nodeSortType, orderExecutorsByProximity, searcherState, sortNodesForEachExecutor, topologyDetails, topoName
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected SchedulingResult
Check scheduling feasibility for a quick failure as the second step inBaseResourceAwareStrategy.schedule(Cluster, TopologyDetails)
.protected boolean
isExecAssignmentToWorkerValid
(ExecutorDetails exec, WorkerSlot worker) Check if any constraints are violated if exec is scheduled on worker.protected void
prepareForScheduling
(Cluster cluster, TopologyDetails topologyDetails) Initialize instance variables as the first step inBaseResourceAwareStrategy.schedule(Cluster, TopologyDetails)
.static boolean
validateSolution
(Cluster cluster, TopologyDetails topo) Determines if a scheduling is valid and all constraints are satisfied (for use in testing).Methods inherited from class org.apache.storm.scheduler.resource.strategies.scheduling.BaseResourceAwareStrategy
assignBoundAckersForNewWorkerSlot, getMaxStateSearchFromTopoConf, hostnameToNodes, idToNode, isOrderByProximity, prepare, schedule, scheduleExecutorsOnNodes, setExecSorter, setNodeSorter
-
Constructor Details
-
ConstraintSolverStrategy
public ConstraintSolverStrategy()
-
-
Method Details
-
prepareForScheduling
Description copied from class:BaseResourceAwareStrategy
Initialize instance variables as the first step inBaseResourceAwareStrategy.schedule(Cluster, TopologyDetails)
. This method may be extended by subclasses to initialize additional variables as inprepareForScheduling(Cluster, TopologyDetails)
.- Overrides:
prepareForScheduling
in classBaseResourceAwareStrategy
- Parameters:
cluster
- on which executors will be scheduled.topologyDetails
- to be scheduled.
-
checkSchedulingFeasibility
Description copied from class:BaseResourceAwareStrategy
Check scheduling feasibility for a quick failure as the second step inBaseResourceAwareStrategy.schedule(Cluster, TopologyDetails)
. If scheduling is not possible, then return a SchedulingStatus object with a failure status. If fully scheduled then return a successful SchedulingStatus. This method can be extended by subclassescheckSchedulingFeasibility()
to check for additional failure conditions.- Overrides:
checkSchedulingFeasibility
in classBaseResourceAwareStrategy
- Returns:
- A non-null
SchedulingResult
to terminate scheduling, otherwise return null to continue scheduling.
-
isExecAssignmentToWorkerValid
Check if any constraints are violated if exec is scheduled on worker.- Overrides:
isExecAssignmentToWorkerValid
in classBaseResourceAwareStrategy
- Parameters:
exec
- being scheduled.worker
- on which to schedule.- Returns:
- true if scheduling exec on worker does not violate any constraints, returns false if it does
-
validateSolution
Determines if a scheduling is valid and all constraints are satisfied (for use in testing). This is done in three steps.- Check if nodeCoLocationCnt-constraints are satisfied. Some components may allow only a certain number of executors to exist on the same node
ConstraintSolverConfig.getMaxNodeCoLocationCnts()
.- Check if incompatibility-constraints are satisfied. Incompatible components
ConstraintSolverConfig.getIncompatibleComponentSets()
should not be put on the same worker.- Check if CPU and Memory resources do not exceed availability on the node and total matches what is expected when fully scheduled.
- Parameters:
cluster
- on which scheduling was done.topo
- TopologyDetails being scheduled.- Returns:
- true if solution is valid, false otherwise.
- Check if nodeCoLocationCnt-constraints are satisfied. Some components may allow only a certain number of executors to exist on the same node
-