private static void closeAndIgnoreExceptions(TezClient session) {
    try {
      session.stop();
    } catch (SessionNotRunning nr) {
      // Ignore.
    } catch (IOException | TezException ex) {
      LOG.info("Failed to close Tez session after failure to initialize: " + ex.getMessage());
    }
  }
Check if Kerberos authentication is enabled.
This is used by:
- HS2 (upon Tez session creation)
In secure scenarios HS2 might either be logged on (by Kerberos) by itself or by a launcher
script it was forked from. In the latter case UGI.getLoginUser().isFromKeytab() returns false,
hence UGI.getLoginUser().hasKerberosCredentials() is a tightest setting we can check against.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java