code: public ResourceRequestInfo getPendingRequestOnRack(
      String host, Node rack, ResourceType type) {
      Context c = getContext(type);
      List<ResourceRequestInfo> rackReqs = c.rackToPendingRequests.get(rack);
      if (rackReqs != null) {
        for (ResourceRequestInfo req: rackReqs) {
          Set<String> excluded = req.getExcludeHosts();
          if (!excluded.contains(host)) {
            return req;
          }
        }
      }
      return null;
    }
docs: Find a pending request that wants to run on a given rack.
  @param host The host we are considering
  @param rack The rack of the host
  @param type the type of the request
  @return The resource request info for the matching request