Skip to main content

ReplicaClient

quarantine_replicas

Add quaratined replicas for RSE.

Arguments:

replicas: List of replica infos: {'scope': <scope> (optional), 'name': <name> (optional), 'path':<path> (required)}.

rse: RSE name.

rse_id: RSE id. Either RSE name or RSE id must be specified, but not both

declare_bad_file_replicas

Declare a list of bad replicas.

Arguments:

replicas: Either a list of PFNs (string) or a list of dicts {'scope': <scope>, 'name': <name>, 'rse_id': <rse_id> or 'rse': <rse_name>}

reason: The reason of the loss.

force: boolean, tell the serrver to ignore existing replica status in the bad_replicas table. Default: False

Returns:

Dictionary {"rse_name": ["did: error",...]} - list of strings for DIDs failed to declare, by RSE

declare_bad_did_replicas

Declare a list of bad replicas.

Arguments:

rse: The RSE where the bad replicas reside

dids: The DIDs of the bad replicas

reason: The reason of the loss.

declare_suspicious_file_replicas

Declare a list of bad replicas.

Arguments:

pfns: The list of PFNs.

reason: The reason of the loss.

get_did_from_pfns

Get the DIDs associated to a PFN on one given RSE

Arguments:

pfns: The list of PFNs.

rse: The RSE name.

Returns:

A list of dictionaries {pfn: {'scope': scope, 'name': name}}

list_replicas

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

Arguments:

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, ...)

ignore_availability: Also include replicas from blocked RSEs into 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', 'latitude', 'longitude'}

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'

signature_lifetime: If supported, in seconds, restrict the lifetime of the signed PFN.

nrandom: pick N random replicas. If the initial number of replicas is smaller than N, returns all replicas.

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.

list_suspicious_replicas

List file replicas tagged as suspicious.

Arguments:

rse_expression: The RSE expression to restrict replicas on a set of RSEs.

younger_than: Datetime object to select the replicas which were declared since younger_than date. Default value = 10 days ago.

nattempts: The minimum number of replica appearances in the bad_replica DB table from younger_than date. Default value = 0.

state: State of the replica, either 'BAD' or 'SUSPICIOUS'. No value returns replicas with either state.

add_replica

Add file replicas to a RSE.

Arguments:

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

Bulk add file replicas to a RSE.

Arguments:

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 blocklsit.

Returns:

True if files were created successfully.

delete_replicas

Bulk delete file replicas from a RSE.

Arguments:

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 blocklist.

Returns:

True if files have been deleted successfully.

update_replicas_states

Bulk update the file replicas states from a RSE.

Arguments:

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) 'U' (UNAVAILABLE) 'C' (COPYING) 'B' (BEING_DELETED) 'D' (BAD) 'T' (TEMPORARY_UNAVAILABLE)

Returns:

True if replica states have been updated successfully, otherwise an exception is raised.

list_dataset_replicas

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

Arguments:

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

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

Arguments:

dids: The list of DIDs of the datasets.

Returns:

A list of dict dataset replicas.

list_dataset_replicas_vp

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.

Arguments:

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

List datasets at a RSE.

Arguments:

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.

add_bad_pfns

Declare a list of bad replicas.

Arguments:

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.

set_tombstone

Set a tombstone on a list of replicas.

Arguments:

replicas: list of replicas.