public static Map<HostRoleStatus, Integer> calculateTaskEntityStatusCounts(Collection<HostRoleCommandEntity> tasks) {
    Collection<HostRoleStatus> hostRoleStatuses = new LinkedList<>();

    for (HostRoleCommandEntity hostRoleCommand : tasks) {
      hostRoleStatuses.add(hostRoleCommand.getStatus());
    }
    return calculateStatusCounts(hostRoleStatuses);
  }
Returns counts of task entities that are in various states.

@param tasks  the collection of task entities

@return a map of counts of tasks keyed by the task status
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java