public class Cluster extends Object
Constructor and Description |
---|
Cluster(INimbus nimbus,
Map<String,SupervisorDetails> supervisors,
Map<String,SchedulerAssignmentImpl> assignments) |
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) |
int |
getAssignedNumWorkers(TopologyDetails topology)
Gets the number of workers assigned to this 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()
Gets all the available slots in the cluster.
|
List<WorkerSlot> |
getAvailableSlots(SupervisorDetails supervisor)
Return all the available slots on this supervisor.
|
Set<String> |
getBlacklistedHosts() |
String |
getHost(String supervisorId) |
Map<String,List<ExecutorDetails>> |
getNeedsSchedulingComponentToExecutors(TopologyDetails topology)
Gets a component-id -> executors map which needs scheduling in this topology.
|
Map<ExecutorDetails,String> |
getNeedsSchedulingExecutorToComponents(TopologyDetails topology)
Gets a executor -> component-id map which needs scheduling in this topology.
|
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 . |
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() |
boolean |
isBlackListed(String supervisorId) |
boolean |
isBlacklistedHost(String host) |
boolean |
isSlotOccupied(WorkerSlot slot)
Checks the specified slot is occupied.
|
boolean |
needsScheduling(TopologyDetails topology)
Does the topology need scheduling?
A topology needs scheduling if one of the following conditions holds:
Although the topology is assigned slots, but is squeezed.
|
List<TopologyDetails> |
needsSchedulingTopologies(Topologies topologies)
Gets all the topologies which needs scheduling.
|
void |
setBlacklistedHosts(Set<String> hosts) |
public Cluster(INimbus nimbus, Map<String,SupervisorDetails> supervisors, Map<String,SchedulerAssignmentImpl> assignments)
public void blacklistHost(String host)
public boolean isBlackListed(String supervisorId)
public boolean isBlacklistedHost(String host)
public List<TopologyDetails> needsSchedulingTopologies(Topologies topologies)
topologies
- public boolean needsScheduling(TopologyDetails topology)
public Map<ExecutorDetails,String> getNeedsSchedulingExecutorToComponents(TopologyDetails topology)
topology
- public Map<String,List<ExecutorDetails>> getNeedsSchedulingComponentToExecutors(TopologyDetails topology)
topology
- public Set<Integer> getUsedPorts(SupervisorDetails supervisor)
cluster
- public Set<Integer> getAvailablePorts(SupervisorDetails supervisor)
cluster
- public Set<Integer> getAssignablePorts(SupervisorDetails supervisor)
public List<WorkerSlot> getAvailableSlots(SupervisorDetails supervisor)
cluster
- public List<WorkerSlot> getAssignableSlots(SupervisorDetails supervisor)
public Collection<ExecutorDetails> getUnassignedExecutors(TopologyDetails topology)
public int getAssignedNumWorkers(TopologyDetails topology)
topology
- public void assign(WorkerSlot slot, String topologyId, Collection<ExecutorDetails> executors)
RuntimeException
- if the specified slot is already occupied.public List<WorkerSlot> getAvailableSlots()
public List<WorkerSlot> getAssignableSlots()
public void freeSlot(WorkerSlot slot)
slot
- public void freeSlots(Collection<WorkerSlot> slots)
slots
- public boolean isSlotOccupied(WorkerSlot slot)
slot
- the slot be to checked.public SchedulerAssignment getAssignmentById(String topologyId)
public SupervisorDetails getSupervisorById(String nodeId)
nodeId
public Collection<WorkerSlot> getUsedSlots()
public List<SupervisorDetails> getSupervisorsByHost(String host)
host
.host
- hostname of the supervisorSupervisorDetails
object.public Map<String,SchedulerAssignment> getAssignments()
public Map<String,SupervisorDetails> getSupervisors()
Copyright © 2016 The Apache Software Foundation. All Rights Reserved.