We can write our CustomScheduler class by implementing the org.apache.storm.scheduler.IScheduler interface. The interface contains two important methods:
- prepare(Map conf): This method only initializes the scheduler
- schedule(Topologies topologies, Cluster cluster): This method contains logic that is responsible for topology workers in the cluster supervisor slots
CustomScheduler contains the following private method, which is responsible for assigning workers to the cluster supervisor slots.
The getSupervisorsByType() method returns the map. The key of the map represents the node type (for example, CPU or GPU) and the value contains the list of supervisor nodes of that type:
private Map<String, ArrayList<SupervisorDetails>> ...