# Replica Methods

class `rucio.client.replicaclient.``ReplicaClient`(rucio_host=None, auth_host=None, account=None, ca_cert=None, auth_type=None, creds=None, timeout=600, user_agent='rucio-clients')

  Bases: `rucio.client.baseclient.BaseClient`

  Replica client class for working with replicas

  `REPLICAS_BASEURL` = 'replicas'
  `add_replica`(rse, scope, name, bytes, adler32, pfn=None, md5=None, meta={})

    Add file replicas to a RSE.

    Parameters: | rse – the RSE name. scope – The scope of the file. name – The name of the file. bytes – The size in bytes. adler32 – adler32 checksum. pfn – PFN of the file for non deterministic RSE. md5 – md5 checksum. meta – Metadata attributes.
    Returns: | True if files were created successfully.

  `add_replicas`(rse, files, ignore_availability=True)

    Bulk add file replicas to a RSE.

    Parameters: | rse – the RSE name. files – The list of files. This is a list of DIDs like : [{‘scope’: <scope1>, ‘name’: <name1>}, {‘scope’: <scope2>, ‘name’: <name2>}, …] ignore_availability – Ignore the RSE blacklisting.
    Returns: | True if files were created successfully.

  `declare_bad_file_replicas`(pfns, reason)

    Declare a list of bad replicas.

    Parameters: | pfns – The list of PFNs. reason – The reason of the loss.

  `declare_suspicious_file_replicas`(pfns, reason)

    Declare a list of bad replicas.

    Parameters: | pfns – The list of PFNs. reason – The reason of the loss.

  `delete_replicas`(rse, files, ignore_availability=True)

    Bulk delete file replicas from a RSE.

    Parameters: | rse – the RSE name. files – The list of files. This is a list of DIDs like : [{‘scope’: <scope1>, ‘name’: <name1>}, {‘scope’: <scope2>, ‘name’: <name2>}, …] ignore_availability – Ignore the RSE blacklisting.
    Returns: | True if files have been deleted successfully.

  `get_did_from_pfns`(pfns, rse=None)

    Get the DIDs associated to a PFN on one given RSE

    Parameters: | pfns – The list of PFNs. rse – The RSE name.
    Returns: | A list of dictionaries {pfn: {‘scope’: scope, ‘name’: name}}

  `list_dataset_replicas`(scope, name, deep=False)

    List dataset replicas for a did (scope:name).

    Parameters: | scope – The scope of the dataset. name – The name of the dataset. deep – Lookup at the file level.
    Returns: | A list of dict dataset replicas.

  `list_datasets_per_rse`(rse, filters=None, limit=None)

    List datasets at a RSE.

    Parameters: | rse – the rse name. filters – dictionary of attributes by which the results should be filtered. limit – limit number.
    Returns: | A list of dict dataset replicas.

  `list_replicas`(dids, schemes=None, unavailable=False, all_states=False, metalink=False, rse_expression=None, client_location=None, sort=None, domain=None, resolve_archives=True)

    List file replicas for a list of data identifiers (DIDs).

    Parameters: | dids – The list of data identifiers (DIDs) like : [{‘scope’: <scope1>, ‘name’: <name1>}, {‘scope’: <scope2>, ‘name’: <name2>}, …] schemes – A list of schemes to filter the replicas. (e.g. file, http, …) unavailable – Also include unavailable replicas in the list. metalink – `False` (default) retrieves as JSON, `True` retrieves as metalink4+xml. rse_expression – The RSE expression to restrict replicas on a set of RSEs. client_location – Client location dictionary for PFN modification {‘ip’, ‘fqdn’, ‘site’} sort – Sort the replicas: `geoip` - based on src/dst IP topographical distance `closeness` - based on src/dst closeness `dynamic` - Rucio Dynamic Smart Sort (tm) domain – Define the domain. None is fallback to ‘wan’, otherwise ‘wan, ‘lan’, or ‘all’ resolve_archives – When set to True, find archives which contain the replicas.
    Returns: | A list of dictionaries with replica information.

  `update_replicas_states`(rse, files)

    Bulk update the file replicas states from a RSE.

    Parameters: | rse – the RSE name. files – The list of files. This is a list of DIDs like : [{‘scope’: <scope1>, ‘name’: <name1>}, {‘scope’: <scope2>, ‘name’: <name2>}, …]
    Returns: | True if files have been deleted successfully.