@Override
    public void run(HookContext hookContext) throws Exception {
      if (hookContext.getHookType() == HookContext.HookType.ON_FAILURE_HOOK) {
        Throwable exception = hookContext.getException();

        if (!(exception instanceof TezRuntimeException)) {
          LOG.info("Exception is not a TezRuntimeException, no need to check further with ReExecuteLostAMQueryPlugin");
          return;
        }

        TezRuntimeException tre = (TezRuntimeException)exception;
        String message = tre.getMessage();
        if (message != null) {
          dagIds.add(tre.getDagId());

          if (LOST_AM_CONTAINER_ERROR_PATTERN.matcher(message).matches()
              || message.contains(UNMANAGED_AM_FAILURE)
              || message.contains(DAG_LOST_FAILURE)) {
            retryPossible = true;
          }
          LOG.info("Got exception message: {} retryPossible: {}, dags seen so far: {}", message, retryPossible,
              dagIds);
        }
      }
    }
Re-Executes a query if tez AM failed because of node/container failure.
ql/src/java/org/apache/hadoop/hive/ql/reexec/ReExecuteLostAMQueryPlugin.java