public void ensureLocalResources(Configuration conf, String[] newFilesNotFromConf)
          throws IOException, LoginException, URISyntaxException, TezException {
    if (resources == null) {
      throw new AssertionError("Ensure called on an unitialized (or closed) session " + sessionId);
    }
    String dir = resources.dagResourcesDir.toString();
    resources.localizedResources.clear();

    // Always localize files from conf; duplicates are handled on FS level.
    // TODO: we could do the same thing as below and only localize if missing.
    //       That could be especially valuable given that this almost always the same set.
    List<LocalResource> lrs = utils.localizeTempFilesFromConf(dir, conf);
    if (lrs != null) {
      resources.localizedResources.addAll(lrs);
    }

    // Localize the non-conf resources that are missing from the current list.
    Map<String, LocalResource> newResources = null;
    if (newFilesNotFromConf != null && newFilesNotFromConf.length > 0) {
      boolean hasResources = !resources.additionalFilesNotFromConf.isEmpty();
      if (hasResources) {
        for (String s : newFilesNotFromConf) {
          hasResources = resources.additionalFilesNotFromConf.keySet().contains(s);
          if (!hasResources) {
            break;
          }
        }
      }
      if (!hasResources) {
        String[] skipFilesFromConf = DagUtils.getTempFilesFromConf(conf);
        newResources = utils.localizeTempFiles(dir, conf, newFilesNotFromConf, skipFilesFromConf);
        if (newResources != null) {
          resources.localizedResources.addAll(newResources.values());
          resources.additionalFilesNotFromConf.putAll(newResources);
        }
      } else {
        resources.localizedResources.addAll(resources.additionalFilesNotFromConf.values());
      }
    }

    // Finally, add the files to the existing AM (if any). The old code seems to do this twice,
    // first for all the new resources regardless of type; and then for all the session resources
    // that are not of type file (see branch-1 calls to addAppMasterLocalFiles: from updateSession
    // and with resourceMap from submit).
    // TODO: Do we really need all this nonsense?
    if (session != null) {
      if (newResources != null && !newResources.isEmpty()) {
        session.addAppMasterLocalFiles(DagUtils.createTezLrMap(null, newResources.values()));
      }
      if (!resources.localizedResources.isEmpty()) {
        session.addAppMasterLocalFiles(
            DagUtils.getResourcesUpdatableForAm(resources.localizedResources));
      }
    }
  }
This is called in openInternal and in TezTask.updateSession to localize conf resources.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java