public abstract class NodePool extends Object
Modifier and Type | Class and Description |
---|---|
static class |
NodePool.NodeAndSlotCounts |
static class |
NodePool.RoundRobinSlotScheduler
Place executors into slots in a round robin way, taking into account
component spreading among different hosts.
|
Modifier and Type | Field and Description |
---|---|
protected Cluster |
cluster |
protected Map<String,Node> |
nodeIdToNode |
Constructor and Description |
---|
NodePool() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addTopology(TopologyDetails td)
Add a topology to the pool.
|
abstract boolean |
canAdd(TopologyDetails td)
Check if this topology can be added to this pool.
|
abstract NodePool.NodeAndSlotCounts |
getNodeAndSlotCountIfSlotsWereTaken(int slots)
Get the number of nodes and slots this would provide to get the slots needed.
|
static int |
getNodeCountIfSlotsWereTaken(int slots,
NodePool[] pools) |
void |
init(Cluster cluster,
Map<String,Node> nodeIdToNode)
Initialize the pool.
|
abstract int |
nodesAvailable()
Get the number of available nodes.
|
static int |
nodesAvailable(NodePool[] pools) |
abstract void |
scheduleAsNeeded(NodePool... lesserPools)
Reschedule any topologies as needed.
|
abstract int |
slotsAvailable()
Get number of available slots.
|
static int |
slotsAvailable(NodePool[] pools) |
abstract Collection<Node> |
takeNodes(int nodesNeeded)
Take up to nodesNeeded from this pool.
|
static Collection<Node> |
takeNodes(int nodesNeeded,
NodePool[] pools) |
static Collection<Node> |
takeNodesBySlot(int slotsNeeded,
NodePool[] pools) |
abstract Collection<Node> |
takeNodesBySlots(int slotsNeeded)
Take nodes from this pool that can fulfill possibly up to the slotsNeeded.
|
public static int slotsAvailable(NodePool[] pools)
public abstract int slotsAvailable()
public static int nodesAvailable(NodePool[] pools)
public abstract int nodesAvailable()
public static Collection<Node> takeNodesBySlot(int slotsNeeded, NodePool[] pools)
public static Collection<Node> takeNodes(int nodesNeeded, NodePool[] pools)
public static int getNodeCountIfSlotsWereTaken(int slots, NodePool[] pools)
public void init(Cluster cluster, Map<String,Node> nodeIdToNode)
cluster
- the clusternodeIdToNode
- the mapping of node id to nodespublic abstract void addTopology(TopologyDetails td)
td
- the topology to addpublic abstract boolean canAdd(TopologyDetails td)
td
- the topologypublic abstract Collection<Node> takeNodesBySlots(int slotsNeeded)
slotsNeeded
- the number of slots that are needed.public abstract NodePool.NodeAndSlotCounts getNodeAndSlotCountIfSlotsWereTaken(int slots)
slots
- the number of slots neededpublic abstract Collection<Node> takeNodes(int nodesNeeded)
nodesNeeded
- the number of nodes that are needed.public abstract void scheduleAsNeeded(NodePool... lesserPools)
lesserPools
- pools that may be used to steal nodes from.Copyright © 2023 The Apache Software Foundation. All rights reserved.