@Override
  public TonyApplicationData fetchData(AnalyticJob job) throws Exception {
    _LOGGER.debug("Fetching data for job " + job.getAppId());
    long finishTime = job.getFinishTime();
    Date date = new Date(finishTime);

    // TODO: We are deriving yyyy/MM/dd from the RM's application finish time, but the TonY Portal actually creates the
    // yyyy/MM/dd directory based off the end time embedded in the jhist file name. This end time is taken before the
    // application finishes and thus is slightly before the RM's application finish time. So it's possible that the
    // yyyy/MM/dd derived from the RM's application finish time is a day later and we may not find the history files.
    // In case we don't find the history files in yyyy/MM/dd, we should check the previous day as well.
    String yearMonthDay = ParserUtils.getYearMonthDayDirectory(date, _zoneId);
    Path jobDir = new Path(_finishedDir, yearMonthDay + Path.SEPARATOR + job.getAppId());
    if (!_fs.exists(jobDir)) {
      // check intermediate dir
      jobDir = new Path(_intermediateDir, job.getAppId());
    }

    _LOGGER.debug("Job directory for " + job.getAppId() + ": " + jobDir);

    // parse config
    Path confFile = new Path(jobDir, Constants.TONY_FINAL_XML);
    if (!_fs.exists(confFile)) {
      // for backward compatibility, see https://github.com/linkedin/TonY/issues/271
      confFile = new Path(jobDir, "config.xml");
    }
    Configuration conf = new Configuration(false);
    if (_fs.exists(confFile)) {
      conf.addResource(_fs.open(confFile));
    }

    // Parse events. For a list of event types, see
    // https://github.com/linkedin/TonY/blob/master/tony-core/src/main/avro/EventType.avsc.
    // We get the task start time from the TASK_STARTED event and the finish time and metrics from the TASK_FINISHED
    // event.
    List<Event> events = ParserUtils.parseEvents(_fs, jobDir);

    return new TonyApplicationData(job.getAppId(), job.getAppType(), conf, events);
  }
Constructor for {@link TonyFetcher}.
@param fetcherConfig  the fetcher configuration
@throws IOException
app/com/linkedin/drelephant/tony/fetchers/TonyFetcher.java