Class RasNode
java.lang.Object
org.apache.storm.scheduler.resource.RasNode
- All Implemented Interfaces:
- Comparable<RasNode>
Represents a single node in the cluster.
- 
Constructor SummaryConstructorsConstructorDescriptionRasNode(String nodeId, SupervisorDetails sup, Cluster cluster, Map<String, WorkerSlot> workerIdToWorker, Map<String, Map<String, Collection<ExecutorDetails>>> assignmentMap) Create a new node.
- 
Method SummaryModifier and TypeMethodDescriptionvoidassign(WorkerSlot target, TopologyDetails td, Collection<ExecutorDetails> executors) Assigns a worker to a node.voidassignSingleExecutor(WorkerSlot ws, ExecutorDetails exec, TopologyDetails td) Assign a single executor to a slot, even if other things are in the slot.intbooleancouldEverFit(ExecutorDetails exec, TopologyDetails td) Is there any possibility that exec could ever fit on this node.booleanvoidfree(WorkerSlot ws) Frees a single slot in this node.voidFree all slots on this node.voidfreeSingleExecutor(ExecutorDetails exec, TopologyDetails topo) frees a single executor.doubleGets the available cpu resources for this node.doubleGets the available memory resources for this node.Get the IDs of all free slots on this node.getId()Get a collection of the topology ids currently running on this node.Gets all available resources for this node.doubleGets the total cpu resources for this node.doubleGets the total memory resources for this node.Gets total resources for this node.getUsedSlots(String topId) Get slots used by the given topology.inthashCode()booleanisAlive()booleantoString()intintintinttotalSlotsUsed(String topId) booleanwouldFit(WorkerSlot ws, ExecutorDetails exec, TopologyDetails td) Would scheduling exec in ws fit with the current resource constraints.
- 
Constructor Details- 
RasNodepublic RasNode(String nodeId, SupervisorDetails sup, Cluster cluster, Map<String, WorkerSlot> workerIdToWorker, Map<String, Map<String, Collection<ExecutorDetails>>> assignmentMap) Create a new node.- Parameters:
- nodeId- the id of the node.
- sup- the supervisor this is for.
- cluster- the cluster this is a part of.
- workerIdToWorker- the mapping of slots already assigned to this node.
- assignmentMap- the mapping of executors already assigned to this node.
 
 
- 
- 
Method Details- 
getId
- 
getHostname
- 
getFreeSlotsIdGet the IDs of all free slots on this node.- Returns:
- the ids of the free slots.
 
- 
getSlotsAvailableToScheduleOn
- 
getFreeSlots
- 
getUsedSlots
- 
getUsedSlotsGet slots used by the given topology.- Parameters:
- topId- the id of the topology to get.
- Returns:
- the slots currently assigned to that topology on this node.
 
- 
isAlivepublic boolean isAlive()
- 
getRunningTopologiesGet a collection of the topology ids currently running on this node.
- 
isTotallyFreepublic boolean isTotallyFree()
- 
totalSlotsFreepublic int totalSlotsFree()
- 
totalSlotsUsedpublic int totalSlotsUsed()
- 
totalSlotsUsed
- 
totalSlotspublic int totalSlots()
- 
freeAllSlotspublic void freeAllSlots()Free all slots on this node. This will update the Cluster too.
- 
freeSingleExecutorfrees a single executor.- Parameters:
- exec- is the executor to free
- topo- the topology the executor is a part of
 
- 
freeFrees a single slot in this node.- Parameters:
- ws- the slot to free
 
- 
assignAssigns a worker to a node.- Parameters:
- target- the worker slot to assign the executors
- td- the topology the executors are from
- executors- executors to assign to the specified worker slot
 
- 
assignSingleExecutorAssign a single executor to a slot, even if other things are in the slot.- Parameters:
- ws- the slot to assign it to.
- exec- the executor to assign.
- td- the topology for the executor.
 
- 
wouldFitWould scheduling exec in ws fit with the current resource constraints.- Parameters:
- ws- the slot to possibly put exec in
- exec- the executor to possibly place in ws
- td- the topology exec is a part of
- Returns:
- true if it would fit else false
 
- 
couldEverFitIs there any possibility that exec could ever fit on this node.- Parameters:
- exec- the executor to schedule
- td- the topology the executor is a part of
- Returns:
- true if there is the possibility it might fit, no guarantee that it will, or false if there is no way it would ever fit.
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
- 
getAvailableMemoryResourcespublic double getAvailableMemoryResources()Gets the available memory resources for this node.- Returns:
- the available memory for this node
 
- 
getTotalResourcesGets total resources for this node.
- 
getTotalAvailableResourcesGets all available resources for this node.- Returns:
- All of the available resources.
 
- 
getTotalMemoryResourcespublic double getTotalMemoryResources()Gets the total memory resources for this node.- Returns:
- the total memory for this node
 
- 
getAvailableCpuResourcespublic double getAvailableCpuResources()Gets the available cpu resources for this node.- Returns:
- the available cpu for this node
 
- 
getTotalCpuResourcespublic double getTotalCpuResources()Gets the total cpu resources for this node.- Returns:
- the total cpu for this node
 
- 
compareTo- Specified by:
- compareToin interface- Comparable<RasNode>
 
 
-