private ExitCode processAppReport(ApplicationReport appReport, AppStatusBuilder appStatusBuilder)
      throws LlapStatusCliException {
    if (appReport == null) {
      appStatusBuilder.setState(State.APP_NOT_FOUND);
      LOG.info("No Application Found");
      return ExitCode.SUCCESS;
    }

    applicationId = appReport.getApplicationId().toString();

    // TODO Maybe add the YARN URL for the app.
    appStatusBuilder.setAmInfo(
        new AmInfo().setAppName(appReport.getName()).setAppType(appReport.getApplicationType()));
    appStatusBuilder.setAppStartTime(appReport.getStartTime());
    switch (appReport.getYarnApplicationState()) {
    case NEW:
    case NEW_SAVING:
    case SUBMITTED:
      appStatusBuilder.setState(State.LAUNCHING);
      return ExitCode.SUCCESS;
    case ACCEPTED:
      appStatusBuilder.maybeCreateAndGetAmInfo().setAppId(applicationId);
      appStatusBuilder.setState(State.LAUNCHING);
      return ExitCode.SUCCESS;
    case RUNNING:
      appStatusBuilder.maybeCreateAndGetAmInfo().setAppId(applicationId);
      // If the app state is running, get additional information from YARN Service
      return ExitCode.SUCCESS;
    case FINISHED:
    case FAILED:
    case KILLED:
      appStatusBuilder.maybeCreateAndGetAmInfo().setAppId(applicationId);
      appStatusBuilder.setAppFinishTime(appReport.getFinishTime());
      appStatusBuilder.setState(State.COMPLETE);
      // add log links and other diagnostics from YARN Service
      return ExitCode.SUCCESS;
    default:
      throw new LlapStatusCliException(ExitCode.INTERNAL_ERROR,
          "Unknown Yarn Application State: " + appReport.getYarnApplicationState());
    }
  }
Populates parts of the AppStatus.

@return an ExitCode. An ExitCode other than ExitCode.SUCCESS implies future progress not possible
@throws LlapStatusCliException
llap-server/src/java/org/apache/hadoop/hive/llap/cli/status/LlapStatusServiceDriver.java