protected static Boolean didStageFailed(List<HostRoleCommand> hostRoleCommands, Set<Role> roles, Map<Role, Float> successFactors) {
    Boolean isFailed = Boolean.FALSE;
    for (Role role: roles) {
      List <HostRoleCommand> hostRoleCommandsOfRole = getHostRoleCommandsOfRole(hostRoleCommands, role);
      List <HostRoleCommand> failedHostRoleCommands =  getFailedHostRoleCommands(hostRoleCommandsOfRole);
      float successRatioForRole = (hostRoleCommandsOfRole.size() - failedHostRoleCommands.size())/hostRoleCommandsOfRole.size();
      Float successFactorForRole =  successFactors.get(role) == null ? 1.0f : successFactors.get(role);
      if (successRatioForRole  < successFactorForRole) {
        isFailed = Boolean.TRUE;
        break;
      }
    }
    return isFailed;
  }
@param hostRoleCommands list of {@link HostRoleCommand} for a stage
@param roles  set of roles to be checked for meeting success criteria
@param successFactors  map of role to it's success factor
@return {Boolean} <code>TRUE</code> if stage failed due to hostRoleCommands of any role not meeting success criteria
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java