code: public ClusterNode getRunnableNode(RequestedNode requestedNode,
                                       LocalityLevel maxLevel,
                                       ResourceType type,
                                       Set<String> excluded) {
      ClusterNode node = null;
      RunnableIndices r = typeToIndices.get(type);
  
      // find host local
      node = r.getRunnableNodeForHost(requestedNode);
  
      if (maxLevel == LocalityLevel.NODE || node != null) {
        return node;
      }
      node = r.getRunnableNodeForRack(requestedNode, excluded);
  
      if (maxLevel == LocalityLevel.RACK || node != null) {
        return node;
      }
  
      // find any node
      node = r.getRunnableNodeForAny(excluded);
  
      return node;
    }
docs: Get a runnable node.
  @param requestedNode The request information.
  @param maxLevel The maximum locality level that we can go to.
  @param type The type of resource.
  @param excluded The excluded nodes.
  @return The runnable node that can be used.