private int run() throws Exception {
    Properties propsDirectOptions = new Properties();

    // Working directory.
    Path tmpDir = new Path(cl.getDirectory());

    long t0 = System.nanoTime();

    FileSystem fs = FileSystem.get(conf);
    FileSystem rawFs = FileSystem.getLocal(conf).getRawFileSystem();

    int threadCount = Math.max(1, Runtime.getRuntime().availableProcessors() / 2);
    ExecutorService executor = Executors.newFixedThreadPool(threadCount,
            new ThreadFactoryBuilder().setNameFormat("llap-pkg-%d").build());

    int rc = 0;
    try {

      setupConf(propsDirectOptions);

      URL logger = conf.getResource(LlapConstants.LOG4j2_PROPERTIES_FILE);
      if (logger == null) {
        throw new Exception("Unable to find required config file: llap-daemon-log4j2.properties");
      }

      Path home = new Path(System.getenv("HIVE_HOME"));
      Path scriptParent = new Path(new Path(home, "scripts"), "llap");
      Path scripts = new Path(scriptParent, "bin");

      if (!rawFs.exists(home)) {
        throw new Exception("Unable to find HIVE_HOME:" + home);
      } else if (!rawFs.exists(scripts)) {
        LOG.warn("Unable to find llap scripts:" + scripts);
      }

      String javaHome = getJavaHome();

      LlapTarComponentGatherer tarComponentGatherer = new LlapTarComponentGatherer(cl, conf, propsDirectOptions,
          fs, rawFs, executor, tmpDir);
      tarComponentGatherer.createDirs();
      tarComponentGatherer.submitTarComponentGatherTasks();

      // TODO: need to move from Python to Java for the rest of the script.
      LlapConfigJsonCreator lcjCreator = new LlapConfigJsonCreator(conf, rawFs, tmpDir, cl.getCache(), cl.getXmx(),
          javaHome);
      lcjCreator.createLlapConfigJson();

      LOG.debug("Config Json generation took " + (System.nanoTime() - t0) + " ns");

      tarComponentGatherer.waitForFinish();

      if (cl.isStarting()) {
        rc = startLlap(tmpDir, scriptParent);
      } else {
        rc = 0;
      }
    } finally {
      executor.shutdown();
      rawFs.close();
      fs.close();
    }

    if (rc == 0) {
      LOG.debug("Exiting successfully");
    } else {
      LOG.info("Exiting with rc = " + rc);
    }
    return rc;
  }
This is a working configuration for the instance to merge various variables.
It is not written out for llap server usage
llap-server/src/java/org/apache/hadoop/hive/llap/cli/service/LlapServiceDriver.java