@VisibleForTesting
  Multimap<String, FaultDomain> computeHostToFaultDomainMap() {
    Multimap<String, FaultDomain> hostToRackMap = HashMultimap.create();
    try {
      List<NodeReport> nodeReport = yarnClient.getNodeReports(NodeState.RUNNING);
      nodeReport.forEach(report -> {
        FaultDomain rack = new FaultDomain(FaultDomainType.RACK, report.getRackName());
        hostToRackMap.put(report.getNodeId().getHost(), rack);
      });
      log.info("Computed the host to rack map successfully from Yarn.");
    } catch (YarnException | IOException e) {
      throw new SamzaException("Yarn threw an exception while getting NodeReports.", e);
    }
    return hostToRackMap;
  }
This method computes the host to rack map from Yarn.
Only the hosts that are running in the cluster will be a part of this map.
@return map of the host and the rack it resides on
samza-yarn/src/main/java/org/apache/samza/job/yarn/YarnFaultDomainManager.java