Class SchedulingSearcherState
java.lang.Object
org.apache.storm.scheduler.resource.strategies.scheduling.SchedulingSearcherState
- 
Constructor SummaryConstructorsConstructorDescriptionSchedulingSearcherState(Map<WorkerSlot, Map<String, Integer>> workerCompAssignmentCnts, Map<RasNode, Map<String, Integer>> nodeCompAssignmentCnts, int maxStatesSearched, long maxTimeMs, List<ExecutorDetails> execs, LinkedList<ExecutorDetails> unassignedAckers, TopologyDetails td, Map<ExecutorDetails, String> execToComp) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbooleanvoidassignCurrentExecutor(Map<ExecutorDetails, String> execToComp, RasNode node, WorkerSlot workerSlot) Attempt to assign current executor (execIndex points to) to worker and node.voidassignSingleBoundAcker(RasNode node, WorkerSlot workerSlot) Remove the head of unassigned ackers and attempt to assign it to a workerSlot as a bound acker.voidbacktrack(Map<ExecutorDetails, String> execToComp, RasNode[] nodesForExec, WorkerSlot[] workerSlotForExec) Backtrack to prior executor that was directly assigned.createSchedulingResult(boolean success, String schedulerClassSimpleName) Get the current unassigned executor.voidfreeWorkerSlotWithBoundAckers(RasNode node, WorkerSlot workerSlot) Free the bound-ackers for the given node and workerSlot.getCompAssignmentCntMapForWorker(WorkerSlot workerSlot) Get a map of component to count for the specified worker slot.intgetComponentCntOnNode(RasNode rasNode, String comp) intintintintgetNumOfAckersToBind(ExecutorDetails exec, WorkerSlot workerSlot) Determine how many bound ackers to put in before assigning the executor to current workerSlot.longintvoidbooleanCheck if the current executor has a different component from the previous one.voidUse this method to log the current component assignments on the Node.voidsetSortedExecs(List<ExecutorDetails> sortedExecs) Reassign the list of executors as long as it contains the same executors as before.
- 
Constructor Details- 
SchedulingSearcherStatepublic SchedulingSearcherState(Map<WorkerSlot, Map<String, Integer>> workerCompAssignmentCnts, Map<RasNode, Map<String, Integer>> nodeCompAssignmentCnts, int maxStatesSearched, long maxTimeMs, List<ExecutorDetails> execs, LinkedList<ExecutorDetails> unassignedAckers, TopologyDetails td, Map<ExecutorDetails, String> execToComp) 
 
- 
- 
Method Details- 
setSortedExecsReassign the list of executors as long as it contains the same executors as before. Executors are normally assigned when this class is instantiated. However, this list may be resorted externally and then reassigned.- Parameters:
- sortedExecs- new list to be assigned.
 
- 
incStatesSearchedpublic void incStatesSearched()
- 
getStartTimeMillispublic long getStartTimeMillis()
- 
getStatesSearchedpublic int getStatesSearched()
- 
getExecSizepublic int getExecSize()
- 
getNumBacktrackpublic int getNumBacktrack()
- 
getExecIndexpublic int getExecIndex()
- 
getUnassignedAckers
- 
peekUnassignedAckers
- 
getBoundAckers
- 
getExecsWithBoundAckers
- 
areSearchLimitsExceededpublic boolean areSearchLimitsExceeded()
- 
nextExecutor
- 
areAllExecsScheduledpublic boolean areAllExecsScheduled()
- 
currentExecGet the current unassigned executor.- Returns:
- the first unassigned executor in execs list.
 
- 
assignCurrentExecutorpublic void assignCurrentExecutor(Map<ExecutorDetails, String> execToComp, RasNode node, WorkerSlot workerSlot) Attempt to assign current executor (execIndex points to) to worker and node. Assignment validity check is done before calling this method.- Parameters:
- execToComp- Mapping from executor to component name.
- node- RasNode on which to schedule.
- workerSlot- WorkerSlot on which to schedule.
 
- 
getNumOfAckersToBindDetermine how many bound ackers to put in before assigning the executor to current workerSlot. Note that the worker slot must be a new worker to build on scheduling. Return 0 if: 1. EitherConfig.TOPOLOGY_RAS_ONE_COMPONENT_PER_WORKERorConfig.TOPOLOGY_RAS_ONE_EXECUTOR_PER_WORKERis enabled. 2. The exec to assign is an acker. 3. The workerSlot is not a new worker. 4. No more unassigned ackers to use.A special scenario: If max heap limit is smaller than (this exec mem + Config.TOPOLOGY_RAS_ACKER_EXECUTORS_PER_WORKERackers' mem), scheduler will bind fewer ackers based on max heap limit.- Parameters:
- exec- the exec to assign into the workerSlot.
- workerSlot- the new worker slot to build.
- Returns:
- the num of bound ackers to assign.
 
- 
backtrackpublic void backtrack(Map<ExecutorDetails, String> execToComp, RasNode[] nodesForExec, WorkerSlot[] workerSlotForExec) Backtrack to prior executor that was directly assigned. This excludes bound-ackers.- Parameters:
- execToComp- map from executor to component.
- nodesForExec- array of nodes for all execIndex - has null values for bound-acker indices.
- workerSlotForExec- array of workerSlots for all execIndex - has null values for bound-acker indices.
 
- 
assignSingleBoundAckerRemove the head of unassigned ackers and attempt to assign it to a workerSlot as a bound acker. - Parameters:
- node- RasNode on which to schedule.
- workerSlot- WorkerSlot on which to schedule.
 
- 
freeWorkerSlotWithBoundAckersFree the bound-ackers for the given node and workerSlot. All the bound-ackers for an executor (and only that executor) are on the same workerSlot.- Parameters:
- node- RasNode to be freed.
- workerSlot- WorkerSlot to be freed.
 
- 
logNodeCompAssignmentspublic void logNodeCompAssignments()Use this method to log the current component assignments on the Node. Useful for debugging and tests.
- 
getCompAssignmentCntMapForWorkerGet a map of component to count for the specified worker slot.- Parameters:
- workerSlot- to check for.
- Returns:
- assignment map of count for components, may be a null.
 
- 
getComponentCntOnNode
- 
createSchedulingResult
- 
isExecCompDifferentFromPriorpublic boolean isExecCompDifferentFromPrior()Check if the current executor has a different component from the previous one. This flag can be used as a quick way to check if the nodes should be sorted.- Returns:
- true if first executor or if the component is same as previous executor. False other wise.
 
 
-