@Override
  public void run(HookContext hookContext) throws Exception {
    assert (hookContext.getHookType() == HookContext.HookType.POST_EXEC_HOOK ||
      hookContext.getHookType() == HookContext.HookType.ON_FAILURE_HOOK);
    HiveConf conf = hookContext.getConf();
    if (!"tez".equals(HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_EXECUTION_ENGINE))) {
      return;
    }

    LOG.info("Executing post execution hook to print workload manager events summary..");
    SessionState.LogHelper console = SessionState.getConsole();
    QueryPlan plan = hookContext.getQueryPlan();
    if (plan == null) {
      return;
    }

    List<TezTask> rootTasks = Utilities.getTezTasks(plan.getRootTasks());
    for (TezTask tezTask : rootTasks) {
      WmContext wmContext = tezTask.getContext().getWmContext();
      if (wmContext != null) {
        wmContext.printJson(console);
        wmContext.shortPrint(console);
      }
    }
  }
Post execution (success or failure) hook to print hive workload manager events summary.
ql/src/java/org/apache/hadoop/hive/ql/hooks/PostExecWMEventsSummaryPrinter.java