'Returns a dictionary mapping the given job IDs to their status
count dictionaries.'

def get_status_counts(self, job_ids):

    if (not job_ids):
        return {}
    id_list = ('(%s)' % ','.join((str(job_id) for job_id in job_ids)))
    cursor = connection.cursor()
    cursor.execute(('\n                                                SELECT    job_id,    status,    aborted,    complete,    COUNT(*)\n                                                FROM    afe_host_queue_entries\n                                                WHERE    job_id    IN    %s\n                                                GROUP    BY    job_id,    status,    aborted,    complete\n                                                ' % id_list))
    all_job_counts = dict(((job_id, {}) for job_id in job_ids))
    for (job_id, status, aborted, complete, count) in cursor.fetchall():
        job_dict = all_job_counts[job_id]
        full_status = HostQueueEntry.compute_full_status(status, aborted, complete)
        job_dict.setdefault(full_status, 0)
        job_dict[full_status] += count
    return all_job_counts
