public class Cluster extends Object
Constructor and Description |
---|
Cluster(Cluster src)
Copy constructor
|
Cluster(INimbus nimbus,
Map<String,SupervisorDetails> supervisors,
Map<String,SchedulerAssignmentImpl> assignments,
Map storm_conf) |
Modifier and Type | Method and Description |
---|---|
void |
assign(WorkerSlot slot,
String topologyId,
Collection<ExecutorDetails> executors)
Assign the slot to the executors for this topology.
|
void |
blacklistHost(String host) |
void |
freeSlot(WorkerSlot slot)
Free the specified slot.
|
void |
freeSlots(Collection<WorkerSlot> slots)
free the slots.
|
Set<Integer> |
getAssignablePorts(SupervisorDetails supervisor) |
List<WorkerSlot> |
getAssignableSlots() |
List<WorkerSlot> |
getAssignableSlots(SupervisorDetails supervisor) |
static Double |
getAssignedMemoryForSlot(Map<String,Object> topConf)
Get heap memory usage for a worker’s main process and logwriter process.
|
int |
getAssignedNumWorkers(TopologyDetails topology) |
SchedulerAssignment |
getAssignmentById(String topologyId)
get the current assignment for the topology.
|
Map<String,SchedulerAssignment> |
getAssignments()
Get all the assignments.
|
Set<Integer> |
getAvailablePorts(SupervisorDetails supervisor)
Return the available ports of this supervisor.
|
List<WorkerSlot> |
getAvailableSlots() |
List<WorkerSlot> |
getAvailableSlots(SupervisorDetails supervisor)
Return all the available slots on this supervisor.
|
Set<String> |
getBlacklistedHosts() |
double |
getClusterTotalCPUResource()
Get the total amount of CPU resources in cluster
|
double |
getClusterTotalMemoryResource()
Get the total amount of memory resources in cluster
|
Map |
getConf() |
String |
getHost(String supervisorId) |
INimbus |
getINimbus() |
Map<String,List<ExecutorDetails>> |
getNeedsSchedulingComponentToExecutors(TopologyDetails topology) |
Map<ExecutorDetails,String> |
getNeedsSchedulingExecutorToComponents(TopologyDetails topology) |
Map<String,List<String>> |
getNetworkTopography() |
Map<String,String> |
getStatusMap()
Get all topology scheduler statuses
|
SupervisorDetails |
getSupervisorById(String nodeId)
Get a specific supervisor with the
nodeId |
Map<String,SupervisorDetails> |
getSupervisors()
Get all the supervisors.
|
List<SupervisorDetails> |
getSupervisorsByHost(String host)
Get all the supervisors on the specified
host . |
Map<String,Double[]> |
getSupervisorsResourcesMap()
Get the amount of used and free resources on a supervisor.
|
Map<String,Double[]> |
getTopologyResourcesMap()
Get the amount of resources used by topologies.
|
Collection<ExecutorDetails> |
getUnassignedExecutors(TopologyDetails topology)
get the unassigned executors of the topology.
|
Set<Integer> |
getUsedPorts(SupervisorDetails supervisor)
Get all the used ports of this supervisor.
|
Collection<WorkerSlot> |
getUsedSlots() |
Collection<WorkerSlot> |
getUsedSlotsByTopologyId(String topologyId)
get slots used by a topology
|
Map<String,Map<WorkerSlot,Double[]>> |
getWorkerResourcesMap()
Gets the reference to the full topology->worker resource map.
|
boolean |
isBlackListed(String supervisorId) |
boolean |
isBlacklistedHost(String host) |
boolean |
isSlotOccupied(WorkerSlot slot) |
boolean |
needsScheduling(TopologyDetails topology)
Does the topology need scheduling?
|
List<TopologyDetails> |
needsSchedulingTopologies(Topologies topologies) |
void |
setAssignments(Map<String,SchedulerAssignment> newAssignments)
set assignments for cluster
|
void |
setBlacklistedHosts(Set<String> hosts) |
void |
setNetworkTopography(Map<String,List<String>> networkTopography) |
void |
setStatus(String topologyId,
String status)
set scheduler status for a topology
|
void |
setStatusMap(Map<String,String> statusMap)
set scheduler status map
|
void |
setSupervisorResources(String supervisorId,
Double[] resources) |
void |
setSupervisorsResourcesMap(Map<String,Double[]> supervisorResources)
Sets the amount of used and free resources on a supervisor.
|
void |
setTopologyResources(String topologyId,
Double[] resources)
Set the amount of resources used used by a topology.
|
void |
setTopologyResourcesMap(Map<String,Double[]> topologyResources)
Set the amount of resources used used by a topology.
|
void |
setWorkerResources(String topologyId,
Map<WorkerSlot,Double[]> resources)
Set the worker resources map for a specific topologyId
|
void |
setWorkerResourcesMap(Map<String,Map<WorkerSlot,Double[]>> resources)
Set the worker resources map for all topologies in source
|
void |
updateAssignedCpuForTopologyAndSupervisor(Topologies topologies)
Update CPU usage for each topology and each supervisor node
|
void |
updateAssignedMemoryForTopologyAndSupervisor(Topologies topologies) |
public Cluster(INimbus nimbus, Map<String,SupervisorDetails> supervisors, Map<String,SchedulerAssignmentImpl> assignments, Map storm_conf)
public Cluster(Cluster src)
Copy constructor
public void blacklistHost(String host)
public boolean isBlackListed(String supervisorId)
public boolean isBlacklistedHost(String host)
public List<TopologyDetails> needsSchedulingTopologies(Topologies topologies)
public boolean needsScheduling(TopologyDetails topology)
Does the topology need scheduling?
A topology needs scheduling if one of the following conditions holds:
public Map<ExecutorDetails,String> getNeedsSchedulingExecutorToComponents(TopologyDetails topology)
topology
- public Map<String,List<ExecutorDetails>> getNeedsSchedulingComponentToExecutors(TopologyDetails topology)
topology
- public Set<Integer> getUsedPorts(SupervisorDetails supervisor)
Get all the used ports of this supervisor.
public Set<Integer> getAvailablePorts(SupervisorDetails supervisor)
Return the available ports of this supervisor.
public Set<Integer> getAssignablePorts(SupervisorDetails supervisor)
public List<WorkerSlot> getAvailableSlots(SupervisorDetails supervisor)
Return all the available slots on this supervisor.
public List<WorkerSlot> getAssignableSlots(SupervisorDetails supervisor)
public Collection<ExecutorDetails> getUnassignedExecutors(TopologyDetails topology)
get the unassigned executors of the topology.
public int getAssignedNumWorkers(TopologyDetails topology)
topology
- public void assign(WorkerSlot slot, String topologyId, Collection<ExecutorDetails> executors)
Assign the slot to the executors for this topology.
RuntimeException
- if the specified slot is already occupied.public List<WorkerSlot> getAvailableSlots()
public List<WorkerSlot> getAssignableSlots()
public void freeSlot(WorkerSlot slot)
Free the specified slot.
slot
- public void freeSlots(Collection<WorkerSlot> slots)
free the slots.
slots
- public boolean isSlotOccupied(WorkerSlot slot)
slot
- the slot be to checked.public SchedulerAssignment getAssignmentById(String topologyId)
get the current assignment for the topology.
public Collection<WorkerSlot> getUsedSlotsByTopologyId(String topologyId)
get slots used by a topology
public SupervisorDetails getSupervisorById(String nodeId)
Get a specific supervisor with the nodeId
public Collection<WorkerSlot> getUsedSlots()
public List<SupervisorDetails> getSupervisorsByHost(String host)
Get all the supervisors on the specified host
.
host
- hostname of the supervisorSupervisorDetails
object.public Map<String,SchedulerAssignment> getAssignments()
Get all the assignments.
public void setAssignments(Map<String,SchedulerAssignment> newAssignments)
set assignments for cluster
public Map<String,SupervisorDetails> getSupervisors()
Get all the supervisors.
public double getClusterTotalCPUResource()
Get the total amount of CPU resources in cluster
public double getClusterTotalMemoryResource()
Get the total amount of memory resources in cluster
public static Double getAssignedMemoryForSlot(Map<String,Object> topConf)
Get heap memory usage for a worker’s main process and logwriter process.
topConf
- public void updateAssignedMemoryForTopologyAndSupervisor(Topologies topologies)
public void updateAssignedCpuForTopologyAndSupervisor(Topologies topologies)
Update CPU usage for each topology and each supervisor node
public void setStatus(String topologyId, String status)
set scheduler status for a topology
public void setTopologyResources(String topologyId, Double[] resources)
Set the amount of resources used used by a topology. Used for displaying resource information on the UI
topologyId
- resources
- describes the resources requested and assigned to topology in the following format in an array: {requestedMemOnHeap, requestedMemOffHeap, requestedCpu, assignedMemOnHeap, assignedMemOffHeap, assignedCpu}public void setTopologyResourcesMap(Map<String,Double[]> topologyResources)
Set the amount of resources used used by a topology. Used for displaying resource information on the UI
topologyResources
- a map that contains multiple topologies and the resources the topology requested and assigned. Key: topology id Value: an array that describes the resources the topology requested and assigned in the following format: {requestedMemOnHeap, requestedMemOffHeap, requestedCpu, assignedMemOnHeap, assignedMemOffHeap, assignedCpu}public Map<String,Double[]> getTopologyResourcesMap()
Get the amount of resources used by topologies. Used for displaying resource information on the UI
public void setSupervisorsResourcesMap(Map<String,Double[]> supervisorResources)
Sets the amount of used and free resources on a supervisor. Used for displaying resource information on the UI
supervisorResources
- a map where the key is the supervisor id and the value is a map that represents resource usage for a supervisor in the following format: {totalMem, totalCpu, usedMem, usedCpu}public Map<String,Double[]> getSupervisorsResourcesMap()
Get the amount of used and free resources on a supervisor. Used for displaying resource information on the UI
public Map<String,Map<WorkerSlot,Double[]>> getWorkerResourcesMap()
Gets the reference to the full topology->worker resource map.
public void setWorkerResourcesMap(Map<String,Map<WorkerSlot,Double[]>> resources)
Set the worker resources map for all topologies in source
resources
- mappublic void setWorkerResources(String topologyId, Map<WorkerSlot,Double[]> resources)
Set the worker resources map for a specific topologyId
topologyId
- the id of the topologyresources
- map for the topologypublic INimbus getINimbus()
public Map getConf()
Copyright © 2019 The Apache Software Foundation. All Rights Reserved.