public class SchedulingSearcherState extends Object
Constructor and Description |
---|
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) |
Modifier and Type | Method and Description |
---|---|
boolean |
areAllExecsScheduled() |
boolean |
areSearchLimitsExceeded() |
void |
assignCurrentExecutor(Map<ExecutorDetails,String> execToComp,
RasNode node,
WorkerSlot workerSlot)
Attempt to assign current executor (execIndex points to) to worker and node.
|
void |
assignSingleBoundAcker(RasNode node,
WorkerSlot workerSlot)
Remove the head of unassigned ackers and attempt to assign it to a workerSlot as a bound acker.
|
void |
backtrack(Map<ExecutorDetails,String> execToComp,
RasNode node,
WorkerSlot workerSlot) |
SchedulingResult |
createSchedulingResult(boolean success,
String schedulerClassSimpleName) |
ExecutorDetails |
currentExec()
Get the current unassigned executor.
|
void |
freeWorkerSlotWithBoundAckers(RasNode node,
WorkerSlot workerSlot)
Free a given workerSlot and all the assigned bound ackers already there.
|
int |
getAckersPerWorker() |
Set<ExecutorDetails> |
getBoundAckers() |
Map<String,Integer> |
getCompAssignmentCntMapForWorker(WorkerSlot workerSlot)
Get a map of component to count for the specified worker slot.
|
int |
getComponentCntOnNode(RasNode rasNode,
String comp) |
int |
getExecIndex() |
int |
getExecSize() |
Set<ExecutorDetails> |
getExecsWithBoundAckers() |
int |
getNumBacktrack() |
int |
getNumOfAckersToBind(ExecutorDetails exec,
WorkerSlot workerSlot)
Determine how many bound ackers to put in before assigning the executor to current workerSlot.
|
long |
getStartTimeMillis() |
int |
getStatesSearched() |
LinkedList<ExecutorDetails> |
getUnassignedAckers() |
Map<WorkerSlot,List<ExecutorDetails>> |
getWorkerSlotToBoundAckers() |
void |
incStatesSearched() |
boolean |
isExecCompDifferentFromPrior()
Check if the current executor has a different component from the previous one.
|
void |
logNodeCompAssignments()
Use this method to log the current component assignments on the Node.
|
SchedulingSearcherState |
nextExecutor() |
ExecutorDetails |
peekUnassignedAckers() |
void |
setSortedExecs(List<ExecutorDetails> sortedExecs)
Reassign the list of executors as long as it contains the same executors as before.
|
public 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)
public void setSortedExecs(List<ExecutorDetails> sortedExecs)
Reassign 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.
sortedExecs
- new list to be assigned.public void incStatesSearched()
public long getStartTimeMillis()
public int getStatesSearched()
public int getExecSize()
public int getNumBacktrack()
public int getExecIndex()
public int getAckersPerWorker()
public LinkedList<ExecutorDetails> getUnassignedAckers()
public ExecutorDetails peekUnassignedAckers()
public Set<ExecutorDetails> getBoundAckers()
public Set<ExecutorDetails> getExecsWithBoundAckers()
public Map<WorkerSlot,List<ExecutorDetails>> getWorkerSlotToBoundAckers()
public boolean areSearchLimitsExceeded()
public SchedulingSearcherState nextExecutor()
public boolean areAllExecsScheduled()
public ExecutorDetails currentExec()
Get the current unassigned executor.
public 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.
execToComp
- Mapping from executor to component name.node
- RasNode on which to schedule.workerSlot
- WorkerSlot on which to schedule.public int getNumOfAckersToBind(ExecutorDetails exec, WorkerSlot workerSlot)
Determine 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. Either Config.TOPOLOGY_RAS_ONE_COMPONENT_PER_WORKER
or Config.TOPOLOGY_RAS_ONE_EXECUTOR_PER_WORKER
is 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_WORKER
ackers’ mem), scheduler will bind fewer ackers based on max heap limit.
exec
- the exec to assign into the workerSlot.workerSlot
- the new worker slot to build.public void backtrack(Map<ExecutorDetails,String> execToComp, RasNode node, WorkerSlot workerSlot)
public void assignSingleBoundAcker(RasNode node, WorkerSlot workerSlot)
Remove the head of unassigned ackers and attempt to assign it to a workerSlot as a bound acker.
node
- RasNode on which to schedule.workerSlot
- WorkerSlot on which to schedule.public void freeWorkerSlotWithBoundAckers(RasNode node, WorkerSlot workerSlot)
Free a given workerSlot and all the assigned bound ackers already there.
node
- RasNode which to be freed.workerSlot
- WorkerSlot on which to schedule.public void logNodeCompAssignments()
Use this method to log the current component assignments on the Node. Useful for debugging and tests.
public Map<String,Integer> getCompAssignmentCntMapForWorker(WorkerSlot workerSlot)
Get a map of component to count for the specified worker slot.
workerSlot
- to check for.public SchedulingResult createSchedulingResult(boolean success, String schedulerClassSimpleName)
public 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.
Copyright © 2022 The Apache Software Foundation. All rights reserved.