private void closeDagClientOnCancellation(DAGClient dagClient) {
    try {
      dagClient.tryKillDAG();
      LOG.info("Waiting for Tez task to shut down: " + this);
      dagClient.waitForCompletion();
    } catch (Exception ex) {
      LOG.warn("Failed to shut down TezTask" + this, ex);
    }
    closeDagClientWithoutEx(dagClient);
  }
Making TezTask backward compatible with the old MR-based Task API (ExecDriver/MapRedTask)
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java