public void run() {

    logger.info("Starting Auto Tuning thread");
    HDFSContext.load();
    Configuration configuration = ElephantContext.instance().getAutoTuningConf();

    Long interval =
        Utils.getNonNegativeLong(configuration, AUTO_TUNING_DAEMON_WAIT_INTERVAL, DEFAULT_METRICS_COMPUTATION_INTERVAL);

    try {
      AutoTuningMetricsController.init();
      BaselineComputeUtil baselineComputeUtil = new BaselineComputeUtil();
      FitnessComputeUtil fitnessComputeUtil = new FitnessComputeUtil();
      ParamGenerator paramGenerator = new PSOParamGenerator();
      JobCompleteDetector jobCompleteDetector = new AzkabanJobCompleteDetector();
      while (!Thread.currentThread().isInterrupted()) {
        try {
          baselineComputeUtil.computeBaseline();
          jobCompleteDetector.updateCompletedExecutions();
          fitnessComputeUtil.updateFitness();
          paramGenerator.getParams();
        } catch (Exception e) {
          logger.error("Error in auto tuner thread ", e);
        }
        Thread.sleep(interval);
      }
    } catch (Exception e) {
      logger.error("Error in auto tuner thread ", e);
    }
    logger.info("Auto tuning thread shutting down");
  }
This class is the AutoTuner Daemon class which runs following thing in order.
- BaselineComputeUtil: Baseline computation for new jobs which are auto tuning enabled
- JobCompleteDetector: Detect if the current execution of the jobs is completed and update the status in DB
- APIFitnessComputeUtil: Compute the recently succeeded jobs fitness
- ParamGenerator : Generate the next set of parameters for suggestion
app/com/linkedin/drelephant/AutoTuner.java