backtype.storm.scheduler
Class Cluster

java.lang.Object
  extended by backtype.storm.scheduler.Cluster

public class Cluster
extends Object


Constructor Summary
Cluster(INimbus nimbus, Map<String,SupervisorDetails> supervisors, Map<String,SchedulerAssignmentImpl> assignments)
           
 
Method Summary
 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cluster

public Cluster(INimbus nimbus,
               Map<String,SupervisorDetails> supervisors,
               Map<String,SchedulerAssignmentImpl> assignments)
Method Detail

setBlacklistedHosts

public void setBlacklistedHosts(Set<String> hosts)

getBlacklistedHosts

public Set<String> getBlacklistedHosts()

blacklistHost

public void blacklistHost(String host)

isBlackListed

public boolean isBlackListed(String supervisorId)

isBlacklistedHost

public boolean isBlacklistedHost(String host)

getHost

public String getHost(String supervisorId)

needsSchedulingTopologies

public List<TopologyDetails> needsSchedulingTopologies(Topologies topologies)
Gets all the topologies which needs scheduling.

Parameters:
topologies -
Returns:

needsScheduling

public boolean needsScheduling(TopologyDetails topology)
Does the topology need scheduling? A topology needs scheduling if one of the following conditions holds:


getNeedsSchedulingExecutorToComponents

public Map<ExecutorDetails,String> getNeedsSchedulingExecutorToComponents(TopologyDetails topology)
Gets a executor -> component-id map which needs scheduling in this topology.

Parameters:
topology -
Returns:

getNeedsSchedulingComponentToExecutors

public Map<String,List<ExecutorDetails>> getNeedsSchedulingComponentToExecutors(TopologyDetails topology)
Gets a component-id -> executors map which needs scheduling in this topology.

Parameters:
topology -
Returns:

getUsedPorts

public Set<Integer> getUsedPorts(SupervisorDetails supervisor)
Get all the used ports of this supervisor.

Parameters:
cluster -
Returns:

getAvailablePorts

public Set<Integer> getAvailablePorts(SupervisorDetails supervisor)
Return the available ports of this supervisor.

Parameters:
cluster -
Returns:

getAssignablePorts

public Set<Integer> getAssignablePorts(SupervisorDetails supervisor)

getAvailableSlots

public List<WorkerSlot> getAvailableSlots(SupervisorDetails supervisor)
Return all the available slots on this supervisor.

Parameters:
cluster -
Returns:

getAssignableSlots

public List<WorkerSlot> getAssignableSlots(SupervisorDetails supervisor)

getUnassignedExecutors

public Collection<ExecutorDetails> getUnassignedExecutors(TopologyDetails topology)
get the unassigned executors of the topology.


getAssignedNumWorkers

public int getAssignedNumWorkers(TopologyDetails topology)
Gets the number of workers assigned to this topology.

Parameters:
topology -
Returns:

assign

public void assign(WorkerSlot slot,
                   String topologyId,
                   Collection<ExecutorDetails> executors)
Assign the slot to the executors for this topology.

Throws:
RuntimeException - if the specified slot is already occupied.

getAvailableSlots

public List<WorkerSlot> getAvailableSlots()
Gets all the available slots in the cluster.

Returns:

getAssignableSlots

public List<WorkerSlot> getAssignableSlots()

freeSlot

public void freeSlot(WorkerSlot slot)
Free the specified slot.

Parameters:
slot -

freeSlots

public void freeSlots(Collection<WorkerSlot> slots)
free the slots.

Parameters:
slots -

isSlotOccupied

public boolean isSlotOccupied(WorkerSlot slot)
Checks the specified slot is occupied.

Parameters:
slot - the slot be to checked.
Returns:

getAssignmentById

public SchedulerAssignment getAssignmentById(String topologyId)
get the current assignment for the topology.


getSupervisorById

public SupervisorDetails getSupervisorById(String nodeId)
Get a specific supervisor with the nodeId


getUsedSlots

public Collection<WorkerSlot> getUsedSlots()

getSupervisorsByHost

public List<SupervisorDetails> getSupervisorsByHost(String host)
Get all the supervisors on the specified host.

Parameters:
host - hostname of the supervisor
Returns:
the SupervisorDetails object.

getAssignments

public Map<String,SchedulerAssignment> getAssignments()
Get all the assignments.


getSupervisors

public Map<String,SupervisorDetails> getSupervisors()
Get all the supervisors.



Copyright © 2014 The Apache Software Foundation. All Rights Reserved.