private void updateTaskCount(Task<?> task,
                               List <Task<?>> visited) {
    numberOfTasks += 1;
    visited.add(task);
    if (task.getChildTasks() != null) {
      for (Task<?> childTask : task.getChildTasks()) {
        if (visited.contains(childTask)) {
          continue;
        }
        updateTaskCount(childTask, 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