@read_session
def list_bad_replicas_history(limit=10000, thread=None, total_threads=None, session=None):
    '\n    List the bad file replicas history. Method only used by necromancer\n\n    :param limit: The maximum number of replicas returned.\n    :param thread: The assigned thread for this necromancer.\n    :param total_threads: The total number of threads of all necromancers.\n    :param session: The database session in use.\n    '
    query = session.query(models.BadReplicas.scope, models.BadReplicas.name, models.BadReplicas.rse_id).filter((models.BadReplicas.state == BadFilesStatus.BAD))
    query = filter_thread_work(session=session, query=query, total_threads=total_threads, thread_id=thread, hash_variable='name')
    query = query.limit(limit)
    bad_replicas = {}
    for (scope, name, rse_id) in query.yield_per(1000):
        if (rse_id not in bad_replicas):
            bad_replicas[rse_id] = []
        bad_replicas[rse_id].append({'scope': scope, 'name': name})
    return bad_replicas
List the bad file replicas history. Method only used by necromancer

:param limit: The maximum number of replicas returned.
:param thread: The assigned thread for this necromancer.
:param total_threads: The total number of threads of all necromancers.
:param session: The database session in use.
@read_session
def list_bad_replicas_history(limit=10000, thread=None, total_threads=None, session=None):
    '\n    List the bad file replicas history. Method only used by necromancer\n\n    :param limit: The maximum number of replicas returned.\n    :param thread: The assigned thread for this necromancer.\n    :param total_threads: The total number of threads of all necromancers.\n    :param session: The database session in use.\n    '
    query = session.query(models.BadReplicas.scope, models.BadReplicas.name, models.BadReplicas.rse_id).filter((models.BadReplicas.state == BadFilesStatus.BAD))
    query = filter_thread_work(session=session, query=query, total_threads=total_threads, thread_id=thread, hash_variable='name')
    query = query.limit(limit)
    bad_replicas = {}
    for (scope, name, rse_id) in query.yield_per(1000):
        if (rse_id not in bad_replicas):
            bad_replicas[rse_id] = []
        bad_replicas[rse_id].append({'scope': scope, 'name': name})
    return bad_replicas