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', vo=None)¶ Bases:
rucio.client.baseclient.BaseClient
Replica client class for working with replicas
-
REPLICAS_BASEURL
= 'replicas'¶
-
add_bad_pfns
(pfns, reason, state, expires_at)¶ Declare a list of bad replicas.
- Parameters
pfns – The list of PFNs.
reason – The reason of the loss.
state – The state of the replica. Either BAD, SUSPICIOUS, TEMPORARY_UNAVAILABLE
expires_at – Specify a timeout for the TEMPORARY_UNAVAILABLE replicas. None for BAD files.
- Returns
True if PFNs were created successfully.
-
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_dataset_replicas_bulk
(dids)¶ List dataset replicas for a did (scope:name).
- Parameters
dids – The list of DIDs of the datasets.
- Returns
A list of dict dataset replicas.
-
list_dataset_replicas_vp
(scope, name, deep=False)¶ List dataset replicas for a DID (scope:name) using the Virtual Placement service.
NOTICE: This is an RnD function and might change or go away at any time.
- Parameters
scope – The scope of the dataset.
name – The name of the dataset.
deep – Lookup at the file level.
- Returns
If VP exists a list of dicts of sites
-
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, resolve_parents=False, updated_after=None)¶ 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 distancecloseness
- based on src/dst closenessdynamic
- 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.
resolve_parents – When set to True, find all parent datasets which contain the replicas.
updated_after – epoch timestamp or datetime object (UTC time), only return replicas updated after this time
- Returns
A list of dictionaries with replica information.
-
set_tombstone
(replicas)¶ Set a tombstone on a list of replicas.
- Parameters
replicas – list of replicas.
-
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>, ‘state’: <state1>}, {‘scope’: <scope2>, ‘name’: <name2>, ‘state’: <state2>}, …], where a state value can be either of: ‘A’ (available) ‘S’ (suspicious) ‘U’ (unavailable) ‘R’ (recovered) ‘B’ (bad) ‘L’ (lost) ‘D’ (deleted)
- Returns
True if replica states have been updated successfully, otherwise an exception is raised.
-