code: void updateDagStatus() {
      // A dag may have nodes that are disabled. It's safer to scan all the nodes.
      // Assume the overhead is minimal. If it is not the case, we can optimize later.
      boolean failed = false;
      for (final Node node : this.nodes) {
        final Status nodeStatus = node.getStatus();
        if (!nodeStatus.isTerminal()) {
          return;
        }
        if (nodeStatus == Status.FAILURE) {
          failed = true;
        }
      }
  
      // Update the dag status only after all nodes have reached terminal states.
      updateDagStatusInternal(failed);
    }
docs: Update the final dag status when all nodes are done.
  
  <p>If any node has not reached its terminal state, this method will simply return.