@transactional_session
def get_source_replicas_for_dataset(scope, name, source_rses=None, total_threads=None, thread_id=None, session=None):
    '\n    Get file replicas for all files of a dataset.\n\n    :param scope:          The scope of the dataset.\n    :param name:           The name of the dataset.\n    :param source_rses:    Possible source RSE_ids to filter on.\n    :param total_threads:  Total threads\n    :param thread_id:      This thread\n    :param session:        The db session in use.\n    :returns:              (files in dataset, replicas in dataset)\n    '
    query = session.query(models.DataIdentifierAssociation.child_scope, models.DataIdentifierAssociation.child_name, models.RSEFileAssociation.rse_id).with_hint(models.DataIdentifierAssociation, 'INDEX_RS_ASC(CONTENTS CONTENTS_PK) NO_INDEX_FFS(CONTENTS CONTENTS_PK)', 'oracle').outerjoin(models.RSEFileAssociation, and_((models.DataIdentifierAssociation.child_scope == models.RSEFileAssociation.scope), (models.DataIdentifierAssociation.child_name == models.RSEFileAssociation.name), (models.RSEFileAssociation.state == ReplicaState.AVAILABLE))).filter((models.DataIdentifierAssociation.scope == scope), (models.DataIdentifierAssociation.name == name))
    if source_rses:
        if (len(source_rses) < 10):
            rse_clause = []
            for rse_id in source_rses:
                rse_clause.append((models.RSEFileAssociation.rse_id == rse_id))
            if rse_clause:
                query = session.query(models.DataIdentifierAssociation.child_scope, models.DataIdentifierAssociation.child_name, models.RSEFileAssociation.rse_id).with_hint(models.DataIdentifierAssociation, 'INDEX_RS_ASC(CONTENTS CONTENTS_PK) NO_INDEX_FFS(CONTENTS CONTENTS_PK)', 'oracle').outerjoin(models.RSEFileAssociation, and_((models.DataIdentifierAssociation.child_scope == models.RSEFileAssociation.scope), (models.DataIdentifierAssociation.child_name == models.RSEFileAssociation.name), (models.RSEFileAssociation.state == ReplicaState.AVAILABLE), or_(*rse_clause))).filter((models.DataIdentifierAssociation.scope == scope), (models.DataIdentifierAssociation.name == name))
    if (total_threads and (total_threads > 1)):
        query = filter_thread_work(session=session, query=query, total_threads=total_threads, thread_id=thread_id, hash_variable='child_name')
    replicas = {}
    for (child_scope, child_name, rse_id) in query:
        if ((child_scope, child_name) in replicas):
            if rse_id:
                replicas[(child_scope, child_name)].append(rse_id)
        else:
            replicas[(child_scope, child_name)] = []
            if rse_id:
                replicas[(child_scope, child_name)].append(rse_id)
    return replicas
Get file replicas for all files of a dataset.

:param scope:          The scope of the dataset.
:param name:           The name of the dataset.
:param source_rses:    Possible source RSE_ids to filter on.
:param total_threads:  Total threads
:param thread_id:      This thread
:param session:        The db session in use.
:returns:              (files in dataset, replicas in dataset)
@transactional_session
def get_source_replicas_for_dataset(scope, name, source_rses=None, total_threads=None, thread_id=None, session=None):
    '\n    Get file replicas for all files of a dataset.\n\n    :param scope:          The scope of the dataset.\n    :param name:           The name of the dataset.\n    :param source_rses:    Possible source RSE_ids to filter on.\n    :param total_threads:  Total threads\n    :param thread_id:      This thread\n    :param session:        The db session in use.\n    :returns:              (files in dataset, replicas in dataset)\n    '
    query = session.query(models.DataIdentifierAssociation.child_scope, models.DataIdentifierAssociation.child_name, models.RSEFileAssociation.rse_id).with_hint(models.DataIdentifierAssociation, 'INDEX_RS_ASC(CONTENTS CONTENTS_PK) NO_INDEX_FFS(CONTENTS CONTENTS_PK)', 'oracle').outerjoin(models.RSEFileAssociation, and_((models.DataIdentifierAssociation.child_scope == models.RSEFileAssociation.scope), (models.DataIdentifierAssociation.child_name == models.RSEFileAssociation.name), (models.RSEFileAssociation.state == ReplicaState.AVAILABLE))).filter((models.DataIdentifierAssociation.scope == scope), (models.DataIdentifierAssociation.name == name))
    if source_rses:
        if (len(source_rses) < 10):
            rse_clause = []
            for rse_id in source_rses:
                rse_clause.append((models.RSEFileAssociation.rse_id == rse_id))
            if rse_clause:
                query = session.query(models.DataIdentifierAssociation.child_scope, models.DataIdentifierAssociation.child_name, models.RSEFileAssociation.rse_id).with_hint(models.DataIdentifierAssociation, 'INDEX_RS_ASC(CONTENTS CONTENTS_PK) NO_INDEX_FFS(CONTENTS CONTENTS_PK)', 'oracle').outerjoin(models.RSEFileAssociation, and_((models.DataIdentifierAssociation.child_scope == models.RSEFileAssociation.scope), (models.DataIdentifierAssociation.child_name == models.RSEFileAssociation.name), (models.RSEFileAssociation.state == ReplicaState.AVAILABLE), or_(*rse_clause))).filter((models.DataIdentifierAssociation.scope == scope), (models.DataIdentifierAssociation.name == name))
    if (total_threads and (total_threads > 1)):
        query = filter_thread_work(session=session, query=query, total_threads=total_threads, thread_id=thread_id, hash_variable='child_name')
    replicas = {}
    for (child_scope, child_name, rse_id) in query:
        if ((child_scope, child_name) in replicas):
            if rse_id:
                replicas[(child_scope, child_name)].append(rse_id)
        else:
            replicas[(child_scope, child_name)] = []
            if rse_id:
                replicas[(child_scope, child_name)].append(rse_id)
    return replicas