public class RasNode extends Object implements Comparable<RasNode>
Represents a single node in the cluster.
Constructor and Description |
---|
RasNode(String nodeId,
SupervisorDetails sup,
Cluster cluster,
Map<String,WorkerSlot> workerIdToWorker,
Map<String,Map<String,Collection<ExecutorDetails>>> assignmentMap)
Create a new node.
|
Modifier and Type | Method and Description |
---|---|
void |
assign(WorkerSlot target,
TopologyDetails td,
Collection<ExecutorDetails> executors)
Assigns a worker to a node.
|
void |
assignSingleExecutor(WorkerSlot ws,
ExecutorDetails exec,
TopologyDetails td)
Assign a single executor to a slot, even if other things are in the slot.
|
int |
compareTo(RasNode o) |
boolean |
couldEverFit(ExecutorDetails exec,
TopologyDetails td)
Is there any possibility that exec could ever fit on this node.
|
boolean |
equals(Object other) |
void |
free(WorkerSlot ws)
Frees a single slot in this node.
|
void |
freeAllSlots()
Free all slots on this node.
|
void |
freeSingleExecutor(ExecutorDetails exec,
TopologyDetails topo)
frees a single executor.
|
double |
getAvailableCpuResources()
Gets the available cpu resources for this node.
|
double |
getAvailableMemoryResources()
Gets the available memory resources for this node.
|
Collection<WorkerSlot> |
getFreeSlots() |
Collection<String> |
getFreeSlotsId()
Get the IDs of all free slots on this node.
|
String |
getHostname() |
String |
getId() |
Collection<String> |
getRunningTopologies()
Get a collection of the topology ids currently running on this node.
|
Collection<WorkerSlot> |
getSlotsAvailableToScheduleOn() |
NormalizedResourceOffer |
getTotalAvailableResources()
Gets all available resources for this node.
|
double |
getTotalCpuResources()
Gets the total cpu resources for this node.
|
double |
getTotalMemoryResources()
Gets the total memory resources for this node.
|
NormalizedResourceOffer |
getTotalResources()
Gets total resources for this node.
|
Collection<WorkerSlot> |
getUsedSlots() |
Collection<WorkerSlot> |
getUsedSlots(String topId)
Get slots used by the given topology.
|
int |
hashCode() |
boolean |
isAlive() |
boolean |
isTotallyFree() |
String |
toString() |
int |
totalSlots() |
int |
totalSlotsFree() |
int |
totalSlotsUsed() |
int |
totalSlotsUsed(String topId) |
boolean |
wouldFit(WorkerSlot ws,
ExecutorDetails exec,
TopologyDetails td)
Would scheduling exec in ws fit with the current resource constraints.
|
public RasNode(String nodeId, SupervisorDetails sup, Cluster cluster, Map<String,WorkerSlot> workerIdToWorker, Map<String,Map<String,Collection<ExecutorDetails>>> assignmentMap)
Create a new node.
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.public String getId()
public String getHostname()
public Collection<String> getFreeSlotsId()
Get the IDs of all free slots on this node.
public Collection<WorkerSlot> getSlotsAvailableToScheduleOn()
public Collection<WorkerSlot> getFreeSlots()
public Collection<WorkerSlot> getUsedSlots()
public Collection<WorkerSlot> getUsedSlots(String topId)
Get slots used by the given topology.
topId
- the id of the topology to get.public boolean isAlive()
public Collection<String> getRunningTopologies()
Get a collection of the topology ids currently running on this node.
public boolean isTotallyFree()
public int totalSlotsFree()
public int totalSlotsUsed()
public int totalSlotsUsed(String topId)
public int totalSlots()
public void freeAllSlots()
Free all slots on this node. This will update the Cluster too.
public void freeSingleExecutor(ExecutorDetails exec, TopologyDetails topo)
frees a single executor.
exec
- is the executor to freetopo
- the topology the executor is a part ofpublic void free(WorkerSlot ws)
Frees a single slot in this node.
ws
- the slot to freepublic void assign(WorkerSlot target, TopologyDetails td, Collection<ExecutorDetails> executors)
Assigns a worker to a node.
target
- the worker slot to assign the executorstd
- the topology the executors are fromexecutors
- executors to assign to the specified worker slotpublic void assignSingleExecutor(WorkerSlot ws, ExecutorDetails exec, TopologyDetails td)
Assign a single executor to a slot, even if other things are in the slot.
ws
- the slot to assign it to.exec
- the executor to assign.td
- the topology for the executor.public boolean wouldFit(WorkerSlot ws, ExecutorDetails exec, TopologyDetails td)
Would scheduling exec in ws fit with the current resource constraints.
ws
- the slot to possibly put exec inexec
- the executor to possibly place in wstd
- the topology exec is a part ofpublic boolean couldEverFit(ExecutorDetails exec, TopologyDetails td)
Is there any possibility that exec could ever fit on this node.
exec
- the executor to scheduletd
- the topology the executor is a part ofpublic double getAvailableMemoryResources()
Gets the available memory resources for this node.
public NormalizedResourceOffer getTotalResources()
Gets total resources for this node.
public NormalizedResourceOffer getTotalAvailableResources()
Gets all available resources for this node.
public double getTotalMemoryResources()
Gets the total memory resources for this node.
public double getAvailableCpuResources()
Gets the available cpu resources for this node.
public double getTotalCpuResources()
Gets the total cpu resources for this node.
public int compareTo(RasNode o)
compareTo
in interface Comparable<RasNode>
Copyright © 2022 The Apache Software Foundation. All rights reserved.