code: public static Set<String> getNodeHosts(YarnClient yarnClient) throws YarnException, IOException {
      ImmutableSet.Builder<String> nodeHosts = ImmutableSet.builder();
      for (NodeReport runningNode : yarnClient.getNodeReports(USABLE_NODE_STATES)) {
        nodeHosts.add(runningNode.getNodeId().getHost());
      }
      return nodeHosts.build();
    }
docs: Returns the host names for all nodes in yarnClient's YARN cluster.
  
  @param yarnClient the client to use to look up node information
  @return the set of host names