@read_session
def get_bad_pfns(limit=10000, thread=None, total_threads=None, session=None):
    "\n    Returns a list of bad PFNs\n\n    :param limit: The maximum number of replicas returned.\n    :param thread: The assigned thread for this minos instance.\n    :param total_threads: The total number of minos threads.\n    :param session: The database session in use.\n\n    returns: list of PFNs {'pfn': pfn, 'state': state, 'reason': reason, 'account': account, 'expires_at': expires_at}\n    "
    result = []
    query = session.query(models.BadPFNs.path, models.BadPFNs.state, models.BadPFNs.reason, models.BadPFNs.account, models.BadPFNs.expires_at)
    query = filter_thread_work(session=session, query=query, total_threads=total_threads, thread_id=thread, hash_variable='path')
    query.order_by(models.BadPFNs.created_at)
    query = query.limit(limit)
    for (path, state, reason, account, expires_at) in query.yield_per(1000):
        result.append({'pfn': clean_surls([str(path)])[0], 'state': state, 'reason': reason, 'account': account, 'expires_at': expires_at})
    return result
Returns a list of bad PFNs

:param limit: The maximum number of replicas returned.
:param thread: The assigned thread for this minos instance.
:param total_threads: The total number of minos threads.
:param session: The database session in use.

returns: list of PFNs {'pfn': pfn, 'state': state, 'reason': reason, 'account': account, 'expires_at': expires_at}
@read_session
def get_bad_pfns(limit=10000, thread=None, total_threads=None, session=None):
    "\n    Returns a list of bad PFNs\n\n    :param limit: The maximum number of replicas returned.\n    :param thread: The assigned thread for this minos instance.\n    :param total_threads: The total number of minos threads.\n    :param session: The database session in use.\n\n    returns: list of PFNs {'pfn': pfn, 'state': state, 'reason': reason, 'account': account, 'expires_at': expires_at}\n    "
    result = []
    query = session.query(models.BadPFNs.path, models.BadPFNs.state, models.BadPFNs.reason, models.BadPFNs.account, models.BadPFNs.expires_at)
    query = filter_thread_work(session=session, query=query, total_threads=total_threads, thread_id=thread, hash_variable='path')
    query.order_by(models.BadPFNs.created_at)
    query = query.limit(limit)
    for (path, state, reason, account, expires_at) in query.yield_per(1000):
        result.append({'pfn': clean_surls([str(path)])[0], 'state': state, 'reason': reason, 'account': account, 'expires_at': expires_at})
    return result