Package org.apache.storm.scheduler
Interface ISchedulingState
- All Known Implementing Classes:
- Cluster,- SingleTopologyCluster
public interface ISchedulingState
An interface that provides access to the current scheduling state.
 The scheduling state is not guaranteed to be thread safe.
- 
Method SummaryModifier and TypeMethodDescriptionGet all scheduled resources for node.getAssignablePorts(SupervisorDetails supervisor) Get the ports that are not blacklisted.Get all non-blacklisted slots in the cluster.getAssignableSlots(SupervisorDetails supervisor) Return all non-blacklisted slots on this supervisor.intgetAssignedNumWorkers(TopologyDetails topology) Get the number of workers assigned to a topology.getAssignedRacks(String... topologyIds) Determine the list of racks on which topologyIds have been assigned.getAssignmentById(String topologyId) get the current assignment for the topology.Get all the assignments.getAvailablePorts(SupervisorDetails supervisor) Return the available ports of this supervisor.Get the resources on the supervisor that are available to be scheduled.Get all the available worker slots in the cluster.getAvailableSlots(SupervisorDetails supervisor) Return all the available slots on this supervisor.Get all of the hosts that are blacklisted.doubleGet the total amount of CPU resources in cluster.Get the total amount of generic resources (excluding CPU and memory) in cluster.doubleGet the total amount of memory resources in cluster.getConf()Get the nimbus configuration.Map a supervisor to a given host.Get host -> rack map - the inverse of networkTopography.Get the component name to executor list for executors that need to be scheduled.Get the executor to component name map for executors that need to be scheduled.Get the network topography (rackId -> nodes in the rack).getNonBlacklistedAvailableSlots(List<String> blacklistedSupervisorIds) Get all the available worker slots in the cluster, that are not blacklisted.getNonBlacklistedClusterAvailableResources(Collection<String> blacklistedSupervisorIds) Get the resources in the cluster that are available for scheduling.doublegetScheduledCpuForNode(String nodeId) Get the total cpu currently scheduled on a node.doublegetScheduledMemoryForNode(String nodeId) Get the total memory currently scheduled on a node.Get all topology scheduler statuses.getSupervisorById(String nodeId) Get a specific supervisor with thenodeId.Get all the supervisors.getSupervisorsByHost(String host) Get all the supervisors on the specifiedhost.Get the amount of used and free resources on a supervisor.Get all of the topologies.Get the amount of resources used by topologies.getUnassignedExecutors(TopologyDetails topology) get the unassigned executors of the topology.getUsedPorts(SupervisorDetails supervisor) Get all the used ports of this supervisor.Get all currently occupied slots.getUsedSlotsByTopologyId(String topologyId) get slots used by a topology.Get the resources for a given slot.Gets the reference to the full topology->worker resource map.booleanisBlackListed(String supervisorId) Check is a given supervisor is on a blacklisted host.booleanisBlacklistedHost(String host) Check if a given host is blacklisted.booleanisSlotOccupied(WorkerSlot slot) Check if a slot is occupied or not.booleanneedsScheduling(TopologyDetails topology) Does the topology need scheduling.booleanneedsSchedulingRas(TopologyDetails topology) LikeneedsScheduling(TopologyDetails)but does not take into account the number of workers requested.Get all of the topologies that need scheduling.booleanwouldFit(WorkerSlot ws, ExecutorDetails exec, TopologyDetails td, NormalizedResourceOffer resourcesAvailable, double maxHeap) Would scheduling exec on ws fit? With a heap <= maxHeap total memory added <= memoryAvailable and cpu added <= cpuAvailable.
- 
Method Details- 
getTopologiesTopologies getTopologies()Get all of the topologies.- Returns:
- all of the topologies that are a part of the cluster.
 
- 
needsSchedulingTopologiesList<TopologyDetails> needsSchedulingTopologies()Get all of the topologies that need scheduling.- Returns:
- all of the topologies that are not fully scheduled.
 
- 
needsSchedulingDoes the topology need scheduling.A topology needs scheduling if one of the following conditions holds: - Although the topology is assigned slots, but is squeezed. i.e. the topology is assigned less slots than desired.
- There are unassigned executors in this topology
 
- 
needsSchedulingRasLikeneedsScheduling(TopologyDetails)but does not take into account the number of workers requested. This is because the number of workers is ignored in RAS- Parameters:
- topology- the topology to check
- Returns:
- true if the topology needs scheduling else false.
 
- 
getBlacklistedHostsGet all of the hosts that are blacklisted.- Returns:
- all of the hosts that are blacklisted
 
- 
isBlackListedCheck is a given supervisor is on a blacklisted host.- Parameters:
- supervisorId- the id of the supervisor
- Returns:
- true if it is else false
 
- 
isBlacklistedHostCheck if a given host is blacklisted.- Parameters:
- host- the name of the host
- Returns:
- true if it is else false.
 
- 
getHostMap a supervisor to a given host.- Parameters:
- supervisorId- the id of the supervisor
- Returns:
- the actual host name the supervisor is on
 
- 
getUnassignedExecutorsget the unassigned executors of the topology.- Parameters:
- topology- the topology to check
- Returns:
- the unassigned executors of the topology.
 
- 
getNeedsSchedulingExecutorToComponentsGet the executor to component name map for executors that need to be scheduled.- Parameters:
- topology- the topology this is for
- Returns:
- a executor -> component-id map which needs scheduling in this topology.
 
- 
getNeedsSchedulingComponentToExecutorsGet the component name to executor list for executors that need to be scheduled.- Parameters:
- topology- the topology this is for
- Returns:
- a component-id -> executors map which needs scheduling in this topology.
 
- 
getUsedPortsGet all the used ports of this supervisor.
- 
getAvailablePortsReturn the available ports of this supervisor.
- 
getAssignablePortsGet the ports that are not blacklisted.- Parameters:
- supervisor- the supervisor
- Returns:
- the ports that are not blacklisted
 
- 
getAvailableSlotsReturn all the available slots on this supervisor.
- 
getAvailableSlotsList<WorkerSlot> getAvailableSlots()Get all the available worker slots in the cluster.
- 
getNonBlacklistedAvailableSlotsGet all the available worker slots in the cluster, that are not blacklisted.- Parameters:
- blacklistedSupervisorIds- list of supervisor ids that should also be considered blacklisted.
 
- 
getAssignableSlotsReturn all non-blacklisted slots on this supervisor.- Parameters:
- supervisor- the supervisor
- Returns:
- the non-blacklisted slots
 
- 
getAssignableSlotsList<WorkerSlot> getAssignableSlots()Get all non-blacklisted slots in the cluster.
- 
getUsedSlotsCollection<WorkerSlot> getUsedSlots()Get all currently occupied slots.
- 
isSlotOccupiedCheck if a slot is occupied or not.- Parameters:
- slot- the slot be to checked.
- Returns:
- true if the specified slot is occupied.
 
- 
getAssignedNumWorkersGet the number of workers assigned to a topology.- Parameters:
- topology- the topology this is for
- Returns:
- the number of workers assigned to this topology.
 
- 
getAvailableResourcesGet the resources on the supervisor that are available to be scheduled.- Parameters:
- sd- the supervisor.
- Returns:
- the resources available to be scheduled.
 
- 
wouldFitboolean wouldFit(WorkerSlot ws, ExecutorDetails exec, TopologyDetails td, NormalizedResourceOffer resourcesAvailable, double maxHeap) Would scheduling exec on ws fit? With a heap <= maxHeap total memory added <= memoryAvailable and cpu added <= cpuAvailable.- Parameters:
- ws- the slot to put it in
- exec- the executor to investigate
- td- the topology detains for this executor
- resourcesAvailable- all the available resources
- maxHeap- the maximum heap size for ws
- Returns:
- true it fits else false
 
- 
getAssignmentByIdget the current assignment for the topology.
- 
getUsedSlotsByTopologyIdget slots used by a topology.
- 
getSupervisorByIdGet a specific supervisor with thenodeId.
- 
getSupervisorsByHostGet all the supervisors on the specifiedhost.- Parameters:
- host- hostname of the supervisor
- Returns:
- the SupervisorDetailsobject.
 
- 
getAssignmentsMap<String,SchedulerAssignment> getAssignments()Get all the assignments.
- 
getSupervisorsMap<String,SupervisorDetails> getSupervisors()Get all the supervisors.
- 
getAllScheduledResourcesForNodeGet all scheduled resources for node.
- 
getNonBlacklistedClusterAvailableResourcesNormalizedResourceOffer getNonBlacklistedClusterAvailableResources(Collection<String> blacklistedSupervisorIds) Get the resources in the cluster that are available for scheduling.- Parameters:
- blacklistedSupervisorIds- other ids that are tentatively blacklisted.
 
- 
getClusterTotalCpuResourcedouble getClusterTotalCpuResource()Get the total amount of CPU resources in cluster.
- 
getClusterTotalMemoryResourcedouble getClusterTotalMemoryResource()Get the total amount of memory resources in cluster.
- 
getClusterTotalGenericResourcesGet the total amount of generic resources (excluding CPU and memory) in cluster.
- 
getNetworkTopographyGet the network topography (rackId -> nodes in the rack).
- 
getHostToRackGet host -> rack map - the inverse of networkTopography.
- 
getStatusMapGet all topology scheduler statuses.
- 
getTopologyResourcesMapMap<String,TopologyResources> getTopologyResourcesMap()Get the amount of resources used by topologies. Used for displaying resource information on the UI.- Returns:
- 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}
 
- 
getSupervisorsResourcesMapMap<String,SupervisorResources> getSupervisorsResourcesMap()Get the amount of used and free resources on a supervisor. Used for displaying resource information on the UI- Returns:
- 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}
 
- 
getWorkerResourcesMapMap<String,Map<WorkerSlot, getWorkerResourcesMap()WorkerResources>> Gets the reference to the full topology->worker resource map.- Returns:
- map of topology -> map of worker slot ->resources for that worker
 
- 
getWorkerResourcesGet the resources for a given slot.- Parameters:
- ws- the slot
- Returns:
- the resources currently assigned
 
- 
getScheduledMemoryForNodeGet the total memory currently scheduled on a node.- Parameters:
- nodeId- the id of the node
- Returns:
- the total memory currently scheduled on the node
 
- 
getScheduledCpuForNodeGet the total cpu currently scheduled on a node.- Parameters:
- nodeId- the id of the node
- Returns:
- the total cpu currently scheduled on the node
 
- 
getConfGet the nimbus configuration.
- 
getAssignedRacksDetermine the list of racks on which topologyIds have been assigned. Note that the returned set may containDNSToSwitchMapping.DEFAULT_RACKifgetHostToRack()is null or does not contain the assigned host.- Parameters:
- topologyIds- for which assignments are examined.
- Returns:
- set of racks on which assignments have been made.
 
 
-