Reads hunt counters.

def ReadHuntCounters(self, hunt_id):
    """Reads hunt counters."""
    num_clients = self.CountHuntFlows(hunt_id)
    num_successful_clients = self.CountHuntFlows(
        hunt_id, filter_condition=db.HuntFlowsCondition.SUCCEEDED_FLOWS_ONLY)
    num_failed_clients = self.CountHuntFlows(
        hunt_id, filter_condition=db.HuntFlowsCondition.FAILED_FLOWS_ONLY)
    num_clients_with_results = len(
        set(r[0].client_id
            for r in self.flow_results.values()
            if r and r[0].hunt_id == hunt_id))
    num_crashed_clients = self.CountHuntFlows(
        hunt_id, filter_condition=db.HuntFlowsCondition.CRASHED_FLOWS_ONLY)
    num_results = self.CountHuntResults(hunt_id)

    total_cpu_seconds = 0
    total_network_bytes_sent = 0
    for f in self.ReadHuntFlows(hunt_id, 0, sys.maxsize):
      total_cpu_seconds += (
          f.cpu_time_used.user_cpu_time + f.cpu_time_used.system_cpu_time)
      total_network_bytes_sent += f.network_bytes_sent

    return db.HuntCounters(
        num_clients=num_clients,
        num_successful_clients=num_successful_clients,
        num_failed_clients=num_failed_clients,
        num_clients_with_results=num_clients_with_results,
        num_crashed_clients=num_crashed_clients,
        num_results=num_results,
        total_cpu_seconds=total_cpu_seconds,
        total_network_bytes_sent=total_network_bytes_sent)