@VisibleForTesting
  void ensureSessionHasResources(
      TezSessionState session, String[] nonConfResources) throws Exception {
    TezClient client = session.getSession();
    // TODO null can also mean that this operation was interrupted. Should we really try to re-create the session in that case ?
    if (client == null) {
      // Note: the only sane case where this can happen is the non-pool one. We should get rid
      //       of it, in non-pool case perf doesn't matter so we might as well open at get time
      //       and then call update like we do in the else.
      // Can happen if the user sets the tez flag after the session was established.
      LOG.info("Tez session hasn't been created yet. Opening session");
      session.open(nonConfResources);
    } else {
      LOG.info("Session is already open");
      session.ensureLocalResources(conf, nonConfResources);
    }
  }
Ensures that the Tez Session is open and the AM has all necessary jars configured.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java