org.apache.storm.scheduler.resource

## Class ResourceAwareScheduler

- java.lang.Object
- - org.apache.storm.scheduler.resource.ResourceAwareScheduler

- All Implemented Interfaces:
    INodeAssignmentSentCallBack, IScheduler

      public class ResourceAwareScheduler
      extends Object
      implements IScheduler

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResourceAwareScheduler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cleanup()` called once when the system is shutting down, should be idempotent.
    `Map<String,Map<String,Double>>` | `config()` This function returns the scheduler’s configuration.
    `Map<String,Set<String>>` | `getEvictedTopologiesMap()` Return eviction information as map {scheduled topo : evicted topos} NOTE this method returns the map of a completed scheduling round.
    `void` | `prepare(Map<String,Object> conf, StormMetricsRegistry metricsRegistry)`
    `void` | `schedule(Topologies topologies, Cluster cluster)` Set assignments for the topologies which needs scheduling.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.storm.scheduler.INodeAssignmentSentCallBack

      `nodeAssignmentSent`

- - ### Constructor Detail

    - #### ResourceAwareScheduler

          public ResourceAwareScheduler()

  - ### Method Detail

    - #### prepare

          public void prepare(Map<String,Object> conf,
                              StormMetricsRegistry metricsRegistry)

      Specified by:
        `prepare` in interface `IScheduler`

    - #### cleanup

          public void cleanup()

      Description copied from interface: `IScheduler`

      called once when the system is shutting down, should be idempotent.

      Specified by:
        `cleanup` in interface `IScheduler`

    - #### config

          public Map<String,Map<String,Double>> config()

      Description copied from interface: `IScheduler`

      This function returns the scheduler’s configuration.

      Specified by:
        `config` in interface `IScheduler`
      Returns:
        The scheduler’s configuration.

    - #### schedule

          public void schedule(Topologies topologies,
                               Cluster cluster)

      Description copied from interface: `IScheduler`

      Set assignments for the topologies which needs scheduling. The new assignments is available through `cluster.getAssignments()`

      Specified by:
        `schedule` in interface `IScheduler`
      Parameters:
        `topologies` - all the topologies in the cluster, some of them need schedule. Topologies object here only contain static information about topologies. Information like assignments, slots are all in the `cluster` object.
        `cluster` - the cluster these topologies are running in. `cluster` contains everything user need to develop a new scheduling logic. e.g. supervisors information, available slots, current assignments for all the topologies etc. User can set the new assignment for topologies using cluster.setAssignmentById()`

    - #### getEvictedTopologiesMap

          public Map<String,Set<String>> getEvictedTopologiesMap()

      Return eviction information as map {scheduled topo : evicted topos} NOTE this method returns the map of a completed scheduling round. If scheduling is going on, this method will return a map of last scheduling round

      TODO: This method is only used for testing . It’s subject to change if we plan to use this info elsewhere.

      Returns:
        a MAP of scheduled (topo : evicted) topos of most recent completed scheduling round

Copyright © 2021 The Apache Software Foundation. All rights reserved.