Replicaclient
Classes¶
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,
logger=LOG,
)
Replica client class for working with replicas
Functions¶
quarantine_replicas ¶
quarantine_replicas(replicas, rse=None, rse_id=None)
Add quaratined replicas for RSE.
PARAMETER | DESCRIPTION |
---|---|
replicas
|
List of replica infos: {'scope':
|
rse
|
RSE name.
DEFAULT:
|
rse_id
|
RSE id. Either RSE name or RSE id must be specified, but not both
DEFAULT:
|
declare_bad_file_replicas ¶
declare_bad_file_replicas(replicas, reason, force=False)
Declare a list of bad replicas.
PARAMETER | DESCRIPTION |
---|---|
replicas
|
Either a list of PFNs (string) or a list of dicts {'scope':
|
reason
|
The reason of the loss.
|
force
|
boolean, tell the serrver to ignore existing replica status in the bad_replicas table. Default: False
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
Dictionary {"rse_name": ["did: error",...]} - list of strings for DIDs failed to declare, by RSE |
declare_bad_did_replicas ¶
declare_bad_did_replicas(rse, dids, reason)
Declare a list of bad replicas.
PARAMETER | DESCRIPTION |
---|---|
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_suspicious_file_replicas(pfns, reason)
Declare a list of bad replicas.
PARAMETER | DESCRIPTION |
---|---|
pfns
|
The list of PFNs.
|
reason
|
The reason of the loss.
|
get_did_from_pfns ¶
get_did_from_pfns(pfns, rse=None)
Get the DIDs associated to a PFN on one given RSE
PARAMETER | DESCRIPTION |
---|---|
pfns
|
The list of PFNs.
|
rse
|
The RSE name.
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
A list of dictionaries {pfn: {'scope': scope, 'name': name}} |
list_replicas ¶
list_replicas(
dids,
schemes=None,
ignore_availability=True,
all_states=False,
metalink=False,
rse_expression=None,
client_location=None,
sort=None,
domain=None,
signature_lifetime=None,
nrandom=None,
resolve_archives=True,
resolve_parents=False,
updated_after=None,
)
List file replicas for a list of data identifiers (DIDs).
PARAMETER | DESCRIPTION |
---|---|
dids
|
The list of data identifiers (DIDs) like : [{'scope':
|
schemes
|
A list of schemes to filter the replicas. (e.g. file, http, ...)
DEFAULT:
|
ignore_availability
|
Also include replicas from blocked RSEs into the list
DEFAULT:
|
metalink
|
DEFAULT:
|
rse_expression
|
The RSE expression to restrict replicas on a set of RSEs.
DEFAULT:
|
client_location
|
Client location dictionary for PFN modification {'ip', 'fqdn', 'site', 'latitude', 'longitude'}
DEFAULT:
|
sort
|
Sort the replicas:
DEFAULT:
|
domain
|
Define the domain. None is fallback to 'wan', otherwise 'wan, 'lan', or 'all'
DEFAULT:
|
signature_lifetime
|
If supported, in seconds, restrict the lifetime of the signed PFN.
DEFAULT:
|
nrandom
|
pick N random replicas. If the initial number of replicas is smaller than N, returns all replicas.
DEFAULT:
|
resolve_archives
|
When set to True, find archives which contain the replicas.
DEFAULT:
|
resolve_parents
|
When set to True, find all parent datasets which contain the replicas.
DEFAULT:
|
updated_after
|
epoch timestamp or datetime object (UTC time), only return replicas updated after this time
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
A list of dictionaries with replica information. |
list_suspicious_replicas ¶
list_suspicious_replicas(
rse_expression=None, younger_than=None, nattempts=None
)
List file replicas tagged as suspicious.
PARAMETER | DESCRIPTION |
---|---|
rse_expression
|
The RSE expression to restrict replicas on a set of RSEs.
DEFAULT:
|
younger_than
|
Datetime object to select the replicas which were declared since younger_than date. Default value = 10 days ago.
DEFAULT:
|
nattempts
|
The minimum number of replica appearances in the bad_replica DB table from younger_than date. Default value = 0.
DEFAULT:
|
state
|
State of the replica, either 'BAD' or 'SUSPICIOUS'. No value returns replicas with either state.
|
add_replica ¶
add_replica(
rse,
scope,
name,
bytes_,
adler32,
pfn=None,
md5=None,
meta=None,
)
Add file replicas to a RSE.
PARAMETER | DESCRIPTION |
---|---|
rse
|
the RSE name.
TYPE:
|
scope
|
The scope of the file.
TYPE:
|
name
|
The name of the file.
TYPE:
|
bytes_
|
The size in bytes.
TYPE:
|
adler32
|
adler32 checksum.
TYPE:
|
pfn
|
PFN of the file for non deterministic RSE.
TYPE:
|
md5
|
md5 checksum.
TYPE:
|
meta
|
Metadata attributes.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
True if files were created successfully. |
add_replicas ¶
add_replicas(rse, files, ignore_availability=True)
Bulk add file replicas to a RSE.
PARAMETER | DESCRIPTION |
---|---|
rse
|
the RSE name.
|
files
|
The list of files. This is a list of DIDs like : [{'scope':
|
ignore_availability
|
Ignore the RSE blocklsit.
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
True if files were created successfully. |
delete_replicas ¶
delete_replicas(rse, files, ignore_availability=True)
Bulk delete file replicas from a RSE.
PARAMETER | DESCRIPTION |
---|---|
rse
|
the RSE name.
|
files
|
The list of files. This is a list of DIDs like : [{'scope':
|
ignore_availability
|
Ignore the RSE blocklist.
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
True if files have been deleted successfully. |
update_replicas_states ¶
update_replicas_states(rse, files)
Bulk update the file replicas states from a RSE.
PARAMETER | DESCRIPTION |
---|---|
rse
|
the RSE name.
|
files
|
The list of files. This is a list of DIDs like : [{'scope':
|
RETURNS | DESCRIPTION |
---|---|
True if replica states have been updated successfully, otherwise an exception is raised. |
list_dataset_replicas ¶
list_dataset_replicas(scope, name, deep=False)
List dataset replicas for a did (scope:name).
PARAMETER | DESCRIPTION |
---|---|
scope
|
The scope of the dataset.
|
name
|
The name of the dataset.
|
deep
|
Lookup at the file level.
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
A list of dict dataset replicas. |
list_dataset_replicas_bulk ¶
list_dataset_replicas_bulk(dids)
List dataset replicas for a did (scope:name).
PARAMETER | DESCRIPTION |
---|---|
dids
|
The list of DIDs of the datasets.
|
RETURNS | DESCRIPTION |
---|---|
A list of dict dataset replicas. |
list_dataset_replicas_vp ¶
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.
PARAMETER | DESCRIPTION |
---|---|
scope
|
The scope of the dataset.
|
name
|
The name of the dataset.
|
deep
|
Lookup at the file level.
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
If VP exists a list of dicts of sites |
list_datasets_per_rse ¶
list_datasets_per_rse(rse, filters=None, limit=None)
List datasets at a RSE.
PARAMETER | DESCRIPTION |
---|---|
rse
|
the rse name.
|
filters
|
dictionary of attributes by which the results should be filtered.
DEFAULT:
|
limit
|
limit number.
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
A list of dict dataset replicas. |
add_bad_pfns ¶
add_bad_pfns(pfns, reason, state, expires_at)
Declare a list of bad replicas.
PARAMETER | DESCRIPTION |
---|---|
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 | DESCRIPTION |
---|---|
True if PFNs were created successfully. |
set_tombstone ¶
set_tombstone(replicas)
Set a tombstone on a list of replicas.
PARAMETER | DESCRIPTION |
---|---|
replicas
|
list of replicas.
|