コード例 #1
0
    def test_list_datasets_per_rse(self):
        """ REPLICA (CLIENT): List datasets in RSE."""
        rule_client = RuleClient()
        did_client = DIDClient()
        scope = 'mock'
        dataset = 'dataset_' + str(generate_uuid())

        did_client.add_dataset(scope=scope, name=dataset)
        rule_client.add_replication_rule(dids=[{
            'scope': scope,
            'name': dataset
        }],
                                         account='root',
                                         copies=1,
                                         rse_expression='MOCK',
                                         grouping='DATASET')
        replicas = [
            r for r in list_datasets_per_rse(
                rse_id=get_rse_id(rse='MOCK', **self.vo),
                filters={
                    'scope': InternalScope(scope, **self.vo),
                    'name': 'data*'
                })
        ]
        assert replicas != []
コード例 #2
0
def list_datasets_per_rse(rse, filters=None, limit=None):
    """
    :param scope: The scope of the dataset.
    :param name: The name of the dataset.
    :param filters: dictionary of attributes by which the results should be filtered.
    :param limit: limit number.
    :param session: Database session to use.

    :returns: A list of dict dataset replicas
    """
    return replica.list_datasets_per_rse(rse, filters=filters, limit=limit)
コード例 #3
0
ファイル: replica.py プロジェクト: purusharths/rucio
def list_datasets_per_rse(rse, filters=None, limit=None):
    """
    :param scope: The scope of the dataset.
    :param name: The name of the dataset.
    :param filters: dictionary of attributes by which the results should be filtered.
    :param limit: limit number.
    :param session: Database session to use.

    :returns: A list of dict dataset replicas
    """

    rse_id = get_rse_id(rse=rse)
    if 'scope' in filters:
        filters['scope'] = InternalScope(filters['scope'])
    for r in replica.list_datasets_per_rse(rse_id, filters=filters, limit=limit):
        yield api_update_return_dict(r)