private boolean areCommandDependenciesFinished(ExecutionCommand command, Stage stage, Set<RoleCommandPair>
    rolesCommandsInProgress) {
    boolean areCommandDependenciesFinished = true;
    RoleCommandOrder rco = roleCommandOrderProvider.getRoleCommandOrder(stage.getClusterId());
    if (rco != null) {
      RoleCommandPair roleCommand = new
              RoleCommandPair(Role.valueOf(command.getRole()), command.getRoleCommand());
      Set<RoleCommandPair> roleCommandDependencies = rco.getDependencies().get(roleCommand);

      // check if there are any dependencies IN_PROGRESS
      if (roleCommandDependencies != null) {
        // remove eventual references to the same RoleCommand
        roleCommandDependencies.remove(roleCommand);
        if (CollectionUtils.containsAny(rolesCommandsInProgress, roleCommandDependencies)) {
          areCommandDependenciesFinished = false;
        }
      }
    }

    return areCommandDependenciesFinished;

  }
Returns true if all command dependencies are already finished (not IN_PROGRESS states).
@param command
@param stage
@param rolesCommandsInProgress
@return
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java