protected int getParallelHostCount(UpgradeContext ctx, int defaultValue) {

    if (m_grouping.parallelScheduler != null) {
      int taskParallelism = m_grouping.parallelScheduler.maxDegreeOfParallelism;
      String maxDegreeFromClusterEnv =
              ctx.getResolver().getValueFromDesiredConfigurations(ConfigHelper.CLUSTER_ENV, "max_degree_parallelism");
      if (StringUtils.isNotEmpty(maxDegreeFromClusterEnv) && StringUtils.isNumeric(maxDegreeFromClusterEnv)) {
        taskParallelism = Integer.parseInt(maxDegreeFromClusterEnv);
      }
      if (taskParallelism == ParallelScheduler.DEFAULT_MAX_DEGREE_OF_PARALLELISM) {
        taskParallelism = ctx.getDefaultMaxDegreeOfParallelism();
      }
      return taskParallelism;
    }

    return defaultValue;
  }
Gets the parallel setting for a grouping, if defined.

@param ctx
         the upgrade context
@param defaultValue
         if the parallel scheduler is not found, return this value instead
@return
         the count of hosts to run in parallel
ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/orchestrate/StageWrapperBuilder.java