public class RAS_Node extends Object
Represents a single node in the cluster.
Constructor and Description |
---|
RAS_Node(String nodeId,
SupervisorDetails sup,
Cluster cluster,
Topologies topologies,
Map<String,WorkerSlot> workerIdToWorker,
Map<String,Map<String,Collection<ExecutorDetails>>> assignmentMap) |
Modifier and Type | Method and Description |
---|---|
void |
assign(WorkerSlot target,
TopologyDetails td,
Collection<ExecutorDetails> executors)
Assigns a worker to a node
|
Double |
consumeCPU(Double amount)
Consumes a certain amount of cpu for this node
|
Double |
consumeMemory(Double amount)
Consumes a certain amount of memory for this node
|
void |
consumeResourcesforTask(ExecutorDetails exec,
TopologyDetails topo)
Consumes a certain amount of resources for a executor in a topology.
|
static int |
countFreeSlotsAlive(Collection<RAS_Node> nodes) |
static int |
countSlotsUsed(Collection<RAS_Node> nodes) |
static int |
countSlotsUsed(String topId,
Collection<RAS_Node> nodes) |
static int |
countTotalSlotsAlive(Collection<RAS_Node> nodes) |
boolean |
equals(Object other) |
TopologyDetails |
findTopologyUsingWorker(WorkerSlot ws)
Find a which topology is running on a worker slot
|
void |
free(WorkerSlot ws)
Frees a single slot in this node
|
void |
freeAllSlots()
Free all slots on this node.
|
void |
freeResourcesForTask(ExecutorDetails exec,
TopologyDetails topo)
frees the amount of resources for a executor in a topology.
|
Double |
getAvailableCpuResources()
Gets the available cpu resources for this node
|
Double |
getAvailableMemoryResources()
Gets the available memory resources for this node
|
double |
getCpuUsedByWorker(WorkerSlot ws)
get the amount of cpu used by a worker
|
static Collection<ExecutorDetails> |
getExecutors(WorkerSlot ws,
Cluster cluster) |
Collection<WorkerSlot> |
getFreeSlots() |
Collection<String> |
getFreeSlotsId() |
String |
getHostname() |
String |
getId() |
double |
getMemoryUsedByWorker(WorkerSlot ws)
get the amount of memory used by a worker
|
Collection<String> |
getRunningTopologies() |
Double |
getTotalCpuResources()
Gets the total cpu resources for this node
|
Double |
getTotalMemoryResources()
Gets the total memory resources for this node
|
Collection<WorkerSlot> |
getUsedSlots() |
Collection<WorkerSlot> |
getUsedSlots(String topId) |
Collection<String> |
getUsedSlotsId() |
int |
hashCode() |
boolean |
isAlive() |
boolean |
isTotallyFree() |
void |
setAvailableMemory(Double amount)
Sets the Available Memory for a node
|
String |
toString() |
int |
totalSlots() |
int |
totalSlotsFree() |
int |
totalSlotsUsed() |
int |
totalSlotsUsed(String topId) |
public RAS_Node(String nodeId, SupervisorDetails sup, Cluster cluster, Topologies topologies, Map<String,WorkerSlot> workerIdToWorker, Map<String,Map<String,Collection<ExecutorDetails>>> assignmentMap)
public String getId()
public String getHostname()
public Collection<String> getFreeSlotsId()
public Collection<WorkerSlot> getFreeSlots()
public Collection<String> getUsedSlotsId()
public Collection<WorkerSlot> getUsedSlots()
public Collection<WorkerSlot> getUsedSlots(String topId)
public boolean isAlive()
public Collection<String> getRunningTopologies()
public boolean isTotallyFree()
public int totalSlotsFree()
public int totalSlotsUsed()
public int totalSlots()
public int totalSlotsUsed(String topId)
public void freeAllSlots()
Free all slots on this node. This will update the Cluster too.
public void free(WorkerSlot ws)
Frees a single slot in this node
ws
- the slot to freepublic double getMemoryUsedByWorker(WorkerSlot ws)
get the amount of memory used by a worker
public double getCpuUsedByWorker(WorkerSlot ws)
get the amount of cpu used by a worker
public TopologyDetails findTopologyUsingWorker(WorkerSlot ws)
Find a which topology is running on a worker slot
public 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 static int countSlotsUsed(String topId, Collection<RAS_Node> nodes)
public static int countSlotsUsed(Collection<RAS_Node> nodes)
public static int countFreeSlotsAlive(Collection<RAS_Node> nodes)
public static int countTotalSlotsAlive(Collection<RAS_Node> nodes)
public static Collection<ExecutorDetails> getExecutors(WorkerSlot ws, Cluster cluster)
public void setAvailableMemory(Double amount)
Sets the Available Memory for a node
amount
- the amount to set as available memorypublic Double getAvailableMemoryResources()
Gets the available memory resources for this node
public Double getTotalMemoryResources()
Gets the total memory resources for this node
public Double consumeMemory(Double amount)
Consumes a certain amount of memory for this node
amount
- is the amount memory to consume from this nodepublic Double getAvailableCpuResources()
Gets the available cpu resources for this node
public Double getTotalCpuResources()
Gets the total cpu resources for this node
public Double consumeCPU(Double amount)
Consumes a certain amount of cpu for this node
amount
- is the amount cpu to consume from this nodepublic void consumeResourcesforTask(ExecutorDetails exec, TopologyDetails topo)
Consumes a certain amount of resources for a executor in a topology.
exec
- is the executor that is consuming resources on this nodetopo
- the topology the executor is a partpublic void freeResourcesForTask(ExecutorDetails exec, TopologyDetails topo)
frees the amount of resources for a executor in a topology.
exec
- is the executor for which the resources are freed fortopo
- the topology the executor is a partCopyright © 2019 The Apache Software Foundation. All Rights Reserved.