@read_session
def list_expired_temporary_unavailable_replicas(total_workers, worker_number, limit=10000, session=None):
    '\n    List the expired temporary unavailable replicas\n\n    :param total_workers:   Number of total workers.\n    :param worker_number:   id of the executing worker.\n    :param limit:           The maximum number of replicas returned.\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.TEMPORARY_UNAVAILABLE)).filter((models.BadReplicas.expires_at < datetime.utcnow())).with_hint(models.ReplicationRule, 'index(bad_replicas BAD_REPLICAS_EXPIRES_AT_IDX)', 'oracle').order_by(models.BadReplicas.expires_at)
    query = filter_thread_work(session=session, query=query, total_threads=total_workers, thread_id=worker_number, hash_variable='name')
    query = query.limit(limit)
    return query.all()
List the expired temporary unavailable replicas

:param total_workers:   Number of total workers.
:param worker_number:   id of the executing worker.
:param limit:           The maximum number of replicas returned.
:param session:         The database session in use.
@read_session
def list_expired_temporary_unavailable_replicas(total_workers, worker_number, limit=10000, session=None):
    '\n    List the expired temporary unavailable replicas\n\n    :param total_workers:   Number of total workers.\n    :param worker_number:   id of the executing worker.\n    :param limit:           The maximum number of replicas returned.\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.TEMPORARY_UNAVAILABLE)).filter((models.BadReplicas.expires_at < datetime.utcnow())).with_hint(models.ReplicationRule, 'index(bad_replicas BAD_REPLICAS_EXPIRES_AT_IDX)', 'oracle').order_by(models.BadReplicas.expires_at)
    query = filter_thread_work(session=session, query=query, total_threads=total_workers, thread_id=worker_number, hash_variable='name')
    query = query.limit(limit)
    return query.all()