Package org.apache.storm.scheduler
Class SchedulerAssignmentImpl
java.lang.Object
org.apache.storm.scheduler.SchedulerAssignmentImpl
- All Implemented Interfaces:
SchedulerAssignment
-
Constructor Summary
ConstructorDescriptionSchedulerAssignmentImpl
(String topologyId) SchedulerAssignmentImpl
(String topologyId, Map<ExecutorDetails, WorkerSlot> executorToSlot, Map<WorkerSlot, WorkerResources> resources, Map<String, Double> nodeIdToTotalSharedOffHeap) Create a new assignment.SchedulerAssignmentImpl
(SchedulerAssignment assignment) -
Method Summary
Modifier and TypeMethodDescriptionvoid
assign
(WorkerSlot slot, Collection<ExecutorDetails> executors) Deprecated.void
assign
(WorkerSlot slot, Collection<ExecutorDetails> executors, WorkerResources slotResources) Assign the slot to executors.boolean
boolean
equalsIgnoreResources
(Object other) Like the equals command, but ignores the resources.Get the set of all executors.Get the map of executor to WorkerSlot.Get the total shared off heap node memory mapping.Get the slot to resource mapping.getSlots()
Get the set of all slots that are a part of this.Get the mapping of slot to executors on that slot.Return the ID of the topology.int
hashCode()
boolean
isExecutorAssigned
(ExecutorDetails executor) Is the executor assigned or not.boolean
isSlotOccupied
(WorkerSlot slot) Is this slot part of this assignment or not.void
setTotalSharedOffHeapNodeMemory
(String node, double value) toString()
void
unassignBySlot
(WorkerSlot slot) Release the slot occupied by this assignment.
-
Constructor Details
-
SchedulerAssignmentImpl
public SchedulerAssignmentImpl(String topologyId, Map<ExecutorDetails, WorkerSlot> executorToSlot, Map<WorkerSlot, WorkerResources> resources, Map<String, Double> nodeIdToTotalSharedOffHeap) Create a new assignment.- Parameters:
topologyId
- the id of the topology the assignment is for.executorToSlot
- the executor to slot mapping for the assignment. Can be null and set through other methods later.resources
- the resources for the current assignments. Can be null and set through other methods later.nodeIdToTotalSharedOffHeap
- the shared memory for this assignment can be null and set through other methods later.
-
SchedulerAssignmentImpl
-
SchedulerAssignmentImpl
-
-
Method Details
-
toString
-
equalsIgnoreResources
Like the equals command, but ignores the resources.- Parameters:
other
- the object to check for equality against.- Returns:
- true if they are equal, ignoring resources, else false.
-
hashCode
public int hashCode() -
equals
-
getSlots
Description copied from interface:SchedulerAssignment
Get the set of all slots that are a part of this.- Specified by:
getSlots
in interfaceSchedulerAssignment
- Returns:
- the set of all slots.
-
assign
Deprecated. -
assign
public void assign(WorkerSlot slot, Collection<ExecutorDetails> executors, WorkerResources slotResources) Assign the slot to executors. -
unassignBySlot
Release the slot occupied by this assignment. -
isSlotOccupied
Description copied from interface:SchedulerAssignment
Is this slot part of this assignment or not.- Specified by:
isSlotOccupied
in interfaceSchedulerAssignment
- Parameters:
slot
- the slot to check.- Returns:
- true if the slot is occupied by this assignment else false.
-
isExecutorAssigned
Description copied from interface:SchedulerAssignment
Is the executor assigned or not.- Specified by:
isExecutorAssigned
in interfaceSchedulerAssignment
- Parameters:
executor
- the executor to check it if is assigned.- Returns:
- true if it is assigned else false
-
getTopologyId
Description copied from interface:SchedulerAssignment
Return the ID of the topology.- Specified by:
getTopologyId
in interfaceSchedulerAssignment
- Returns:
- the topology-id this assignment is for.
-
getExecutorToSlot
Description copied from interface:SchedulerAssignment
Get the map of executor to WorkerSlot.- Specified by:
getExecutorToSlot
in interfaceSchedulerAssignment
- Returns:
- the executor -> slot map.
-
getExecutors
Description copied from interface:SchedulerAssignment
Get the set of all executors.- Specified by:
getExecutors
in interfaceSchedulerAssignment
- Returns:
- the executors covered by this assignments
-
getSlotToExecutors
Description copied from interface:SchedulerAssignment
Get the mapping of slot to executors on that slot.- Specified by:
getSlotToExecutors
in interfaceSchedulerAssignment
- Returns:
- the slot to the executors assigned to that slot.
-
getScheduledResources
Description copied from interface:SchedulerAssignment
Get the slot to resource mapping.- Specified by:
getScheduledResources
in interfaceSchedulerAssignment
- Returns:
- The slot to resource mapping
-