Package org.apache.storm.scheduler
Class SchedulerAssignmentImpl
- java.lang.Object
-
- org.apache.storm.scheduler.SchedulerAssignmentImpl
-
- All Implemented Interfaces:
SchedulerAssignment
public class SchedulerAssignmentImpl extends Object implements SchedulerAssignment
-
-
Constructor Summary
Constructors Constructor Description SchedulerAssignmentImpl(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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidassign(WorkerSlot slot, Collection<ExecutorDetails> executors)Deprecated.voidassign(WorkerSlot slot, Collection<ExecutorDetails> executors, WorkerResources slotResources)Assign the slot to executors.booleanequals(Object other)booleanequalsIgnoreResources(Object other)Like the equals command, but ignores the resources.Set<ExecutorDetails>getExecutors()Get the set of all executors.Map<ExecutorDetails,WorkerSlot>getExecutorToSlot()Get the map of executor to WorkerSlot.Map<String,Double>getNodeIdToTotalSharedOffHeapNodeMemory()Get the total shared off heap node memory mapping.Map<WorkerSlot,WorkerResources>getScheduledResources()Get the slot to resource mapping.Set<WorkerSlot>getSlots()Get the set of all slots that are a part of this.Map<WorkerSlot,Collection<ExecutorDetails>>getSlotToExecutors()Get the mapping of slot to executors on that slot.StringgetTopologyId()Return the ID of the topology.inthashCode()booleanisExecutorAssigned(ExecutorDetails executor)Is the executor assigned or not.booleanisSlotOccupied(WorkerSlot slot)Is this slot part of this assignment or not.voidsetTotalSharedOffHeapNodeMemory(String node, double value)StringtoString()voidunassignBySlot(WorkerSlot slot)Release the slot occupied by this assignment.
-
-
-
Constructor Detail
-
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
public SchedulerAssignmentImpl(String topologyId)
-
SchedulerAssignmentImpl
public SchedulerAssignmentImpl(SchedulerAssignment assignment)
-
-
Method Detail
-
equalsIgnoreResources
public boolean equalsIgnoreResources(Object other)
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.
-
getSlots
public Set<WorkerSlot> getSlots()
Description copied from interface:SchedulerAssignmentGet the set of all slots that are a part of this.- Specified by:
getSlotsin interfaceSchedulerAssignment- Returns:
- the set of all slots.
-
assign
@Deprecated public void assign(WorkerSlot slot, Collection<ExecutorDetails> executors)
Deprecated.
-
assign
public void assign(WorkerSlot slot, Collection<ExecutorDetails> executors, WorkerResources slotResources)
Assign the slot to executors.
-
unassignBySlot
public void unassignBySlot(WorkerSlot slot)
Release the slot occupied by this assignment.
-
isSlotOccupied
public boolean isSlotOccupied(WorkerSlot slot)
Description copied from interface:SchedulerAssignmentIs this slot part of this assignment or not.- Specified by:
isSlotOccupiedin interfaceSchedulerAssignment- Parameters:
slot- the slot to check.- Returns:
- true if the slot is occupied by this assignment else false.
-
isExecutorAssigned
public boolean isExecutorAssigned(ExecutorDetails executor)
Description copied from interface:SchedulerAssignmentIs the executor assigned or not.- Specified by:
isExecutorAssignedin interfaceSchedulerAssignment- Parameters:
executor- the executor to check it if is assigned.- Returns:
- true if it is assigned else false
-
getTopologyId
public String getTopologyId()
Description copied from interface:SchedulerAssignmentReturn the ID of the topology.- Specified by:
getTopologyIdin interfaceSchedulerAssignment- Returns:
- the topology-id this assignment is for.
-
getExecutorToSlot
public Map<ExecutorDetails,WorkerSlot> getExecutorToSlot()
Description copied from interface:SchedulerAssignmentGet the map of executor to WorkerSlot.- Specified by:
getExecutorToSlotin interfaceSchedulerAssignment- Returns:
- the executor -> slot map.
-
getExecutors
public Set<ExecutorDetails> getExecutors()
Description copied from interface:SchedulerAssignmentGet the set of all executors.- Specified by:
getExecutorsin interfaceSchedulerAssignment- Returns:
- the executors covered by this assignments
-
getSlotToExecutors
public Map<WorkerSlot,Collection<ExecutorDetails>> getSlotToExecutors()
Description copied from interface:SchedulerAssignmentGet the mapping of slot to executors on that slot.- Specified by:
getSlotToExecutorsin interfaceSchedulerAssignment- Returns:
- the slot to the executors assigned to that slot.
-
getScheduledResources
public Map<WorkerSlot,WorkerResources> getScheduledResources()
Description copied from interface:SchedulerAssignmentGet the slot to resource mapping.- Specified by:
getScheduledResourcesin interfaceSchedulerAssignment- Returns:
- The slot to resource mapping
-
setTotalSharedOffHeapNodeMemory
public void setTotalSharedOffHeapNodeMemory(String node, double value)
-
getNodeIdToTotalSharedOffHeapNodeMemory
public Map<String,Double> getNodeIdToTotalSharedOffHeapNodeMemory()
Description copied from interface:SchedulerAssignmentGet the total shared off heap node memory mapping.- Specified by:
getNodeIdToTotalSharedOffHeapNodeMemoryin interfaceSchedulerAssignment- Returns:
- host to total shared off heap node memory mapping.
-
-