public void addDependentTask(Task<?> dependent) {
    if (tasks.isEmpty()) {
      addTask(dependent);
    } else {
      DAGTraversal.traverse(tasks, new AddDependencyToLeaves(dependent));

      List<Task<?>> visited = new ArrayList<>();
      updateTaskCount(dependent, visited);
    }
  }
this method is used to identify all the tasks in a graph.
the graph however might get created in a disjoint fashion, in which case we can just update
the number of tasks using the "update" method.
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/util/TaskTracker.java