Skip to content

Rseclient

RSEClient(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)

RSE client class for working with rucio RSEs

Constructor of the BaseClient.

Parameters:

Name Type Description Default
rucio_host Optional[str]

The address of the rucio server, if None it is read from the config file.

None
rucio_port

The port of the rucio server, if None it is read from the config file.

required
auth_host Optional[str]

The address of the rucio authentication server, if None it is read from the config file.

None
auth_port

The port of the rucio authentication server, if None it is read from the config file.

required
account Optional[str]

The account to authenticate to rucio.

None
use_ssl

Enable or disable ssl for commucation. Default is enabled.

required
ca_cert Optional[str]

The path to the rucio server certificate.

None
auth_type Optional[str]

The type of authentication (e.g.: 'userpass', 'kerberos' ...)

None
creds Optional[dict[str, Any]]

Dictionary with credentials needed for authentication.

None
user_agent Optional[str]

Indicates the client.

'rucio-clients'
vo Optional[str]

The VO to authenticate into.

None
logger Logger

Logger object to use. If None, use the default LOG created by the module

LOG

get_rse(rse)

Returns details about the referred RSE.

Parameters:

Name Type Description Default
rse str

Name of the referred RSE

required

Returns:

Type Description
dict[str, Any]

A dict containing all attributes of the referred RSE

Raises:

Type Description
RSENotFound

if the referred RSE was not found in the database

add_rse(rse, **kwargs)

Sends the request to create a new RSE.

Parameters:

Name Type Description Default
rse str

the name of the rse.

required
deterministic

Boolean to know if the pfn is generated deterministically.

required
volatile

Boolean for RSE cache.

required
city

City for the RSE.

required
region_code

The region code for the RSE.

required
country_name

The country.

required
continent

The continent.

required
time_zone

Timezone.

required
staging_area

Staging area.

required
ISP

Internet service provider.

required
rse_type

RSE type.

required
latitude

Latitude coordinate of RSE.

required
longitude

Longitude coordinate of RSE.

required
ASN

Access service network.

required
availability

Availability.

required

Returns:

Type Description
Literal[True]

True if location was created successfully else False.

Raises:

Type Description
Duplicate

if rse already exists.

update_rse(rse, parameters)

Update RSE properties like availability or name.

Parameters:

Name Type Description Default
rse str

the name of the new rse.

required
parameters

A dictionary with property (name, read, write, delete as keys).

required

delete_rse(rse)

Sends the request to delete a rse.

Parameters:

Name Type Description Default
rse str

the name of the rse.

required

Returns:

Type Description
Literal[True]

True if location was created successfully else False.

list_rses(rse_expression=None)

Sends the request to list all rucio locations(RSEs).

:rse_expression: RSE Expression to use as filter.

Returns:

Type Description
Iterator[dict[str, Any]]

a list containing the names of all rucio locations.

add_rse_attribute(rse, key, value)

Sends the request to add a RSE attribute.

Parameters:

Name Type Description Default
rse str

the name of the rse.

required
key str

the attribute key.

required
value Any

the attribute value.

required

Returns:

Type Description
Literal[True]

True if RSE attribute was created successfully else False.

Raises:

Type Description
Duplicate

if RSE attribute already exists.

delete_rse_attribute(rse, key)

Sends the request to delete a RSE attribute.

Parameters:

Name Type Description Default
rse str

the RSE name.

required
key str

the attribute key.

required

Returns:

Type Description
Literal[True]

True if RSE attribute was deleted successfully else False.

list_rse_attributes(rse)

Sends the request to get RSE attributes.

Parameters:

Name Type Description Default
rse str

The RSE name.

required

Returns:

Type Description
dict[str, Any]

A dict with the RSE attribute name/value pairs.

add_protocol(rse, params)

Sends the request to create a new protocol for the given RSE.

Parameters:

Name Type Description Default
rse str

the name of the rse.

required
scheme

identifier of this protocol

required
params dict[str, Any]

Attributes of the protocol. Supported are: hostname: hostname for this protocol (default = localhost) port: port for this protocol (default = 0) prefix: string used as a prfeix for this protocol when generating the PFN (default = None) impl: qualified name of the implementation class for this protocol (mandatory) read: integer representing the priority of this procotol for read operations (default = -1) write: integer representing the priority of this procotol for write operations (default = -1) delete: integer representing the priority of this procotol for delete operations (default = -1) extended_attributes: miscellaneous protocol specific information e.g. spacetoken for SRM (default = None)

required

Returns:

Type Description
Literal[True]

True if protocol was created successfully else False.

Raises:

Type Description
Duplicate

if protocol with same hostname, port and protocol identifier already exists for the given RSE.

RSENotFound

if the RSE doesn't exist.

KeyNotFound

if params is missing manadtory attributes to create the protocol.

AccessDenied

if not authorized.

get_protocols(rse, protocol_domain='ALL', operation=None, default=False, scheme=None)

Returns protocol information. Parameter combinations are: (operation OR default) XOR protocol.

Parameters:

Name Type Description Default
rse str

the RSE name.

required
protocol_domain RSE_SUPPORTED_PROTOCOL_DOMAINS_LITERAL

The scope of the protocol. Supported are 'LAN', 'WAN', and 'ALL' (as default).

'ALL'
operation Optional[RSE_ALL_SUPPORTED_PROTOCOL_OPERATIONS_LITERAL]

The name of the requested operation (read, write, or delete). If None, all operations are queried.

None
default bool

Indicates if only the default operations should be returned.

False
scheme Optional[SUPPORTED_PROTOCOLS_LITERAL]

The identifier of the requested protocol.

None

Returns:

Type Description
Any

A dict with details about each matching protocol.

Raises:

Type Description
RSENotFound

if the RSE doesn't exist.

RSEProtocolNotSupported

if no matching protocol entry could be found.

RSEOperationNotSupported

if no matching protocol entry for the requested operation could be found.

lfns2pfns(rse, lfns, protocol_domain='ALL', operation=None, scheme=None)

Returns PFNs that should be used at a RSE, corresponding to requested LFNs. The PFNs are generated for the RSE regardless of whether a replica exists for the LFN.

Parameters:

Name Type Description Default
rse str

the RSE name

required
lfns Iterable[str]

A list of LFN strings to translate to PFNs.

required
protocol_domain RSE_SUPPORTED_PROTOCOL_DOMAINS_LITERAL

The scope of the protocol. Supported are 'LAN', 'WAN', and 'ALL' (as default).

'ALL'
operation Optional[RSE_ALL_SUPPORTED_PROTOCOL_OPERATIONS_LITERAL]

The name of the requested operation (read, write, or delete). If None, all operations are queried.

None
scheme Optional[SUPPORTED_PROTOCOLS_LITERAL]

The identifier of the requested protocol (gsiftp, https, davs, etc).

None

Returns:

Type Description
dict[str, str]

A dictionary of LFN / PFN pairs.

Raises:

Type Description
RSENotFound

if the RSE doesn't exist.

RSEProtocolNotSupported

if no matching protocol entry could be found.

RSEOperationNotSupported

if no matching protocol entry for the requested operation could be found.

delete_protocols(rse, scheme, hostname=None, port=None)

Deletes matching protocols from RSE. Protocols using the same identifier can be distinguished by hostname and port.

Parameters:

Name Type Description Default
rse str

the RSE name.

required
scheme SUPPORTED_PROTOCOLS_LITERAL

identifier of the protocol.

required
hostname Optional[str]

hostname of the protocol.

None
port Optional[int]

port of the protocol.

None

Returns:

Type Description
Literal[True]

True if success.

Raises:

Type Description
RSEProtocolNotSupported

if no matching protocol entry could be found.

RSENotFound

if the RSE doesn't exist.

AccessDenied

if not authorized.

update_protocols(rse, scheme, data, hostname=None, port=None)

Updates matching protocols from RSE. Protocol using the same identifier can be distinguished by hostname and port.

Parameters:

Name Type Description Default
rse str

the RSE name.

required
scheme SUPPORTED_PROTOCOLS_LITERAL

identifier of the protocol.

required
data dict[str, Any]

A dict providing the new values of the protocol attributes. Keys must match column names in database.

required
hostname Optional[str]

hostname of the protocol.

None
port Optional[int]

port of the protocol.

None

Returns:

Type Description

True if success.

Raises:

Type Description
RSEProtocolNotSupported

if no matching protocol entry could be found.

RSENotFound

if the RSE doesn't exist.

KeyNotFound

if invalid data was provided for update.

AccessDenied

if not authorized.

swap_protocols(rse, domain, operation, scheme_a, scheme_b)

Swaps the priorities of the provided operation.

Parameters:

Name Type Description Default
rse str

the RSE name.

required
domain RSE_SUPPORTED_PROTOCOL_DOMAINS_LITERAL

the domain in which priorities should be swapped i.e. wan or lan.

required
operation RSE_ALL_SUPPORTED_PROTOCOL_OPERATIONS_LITERAL

the operation that should be swapped i.e. read, write, or delete.

required
scheme_a SUPPORTED_PROTOCOLS_LITERAL

the scheme of one of the two protocols to be swapped, e.g. srm.

required
scheme_b SUPPORTED_PROTOCOLS_LITERAL

the scheme of the other of the two protocols to be swapped, e.g. http.

required

Returns:

Type Description
bool

True if success.

Raises:

Type Description
RSEProtocolNotSupported

if no matching protocol entry could be found.

RSENotFound

if the RSE doesn't exist.

KeyNotFound

if invalid data was provided for update.

AccessDenied

if not authorized.

add_qos_policy(rse, qos_policy)

Add a QoS policy from an RSE.

Parameters:

Name Type Description Default
rse_id

The id of the RSE.

required
qos_policy str

The QoS policy to add.

required
session

The database session in use.

required

Returns:

Type Description
Literal[True]

True if successful, except otherwise.

Raises:

Type Description
Duplicate

If the QoS policy already exists.

delete_qos_policy(rse, qos_policy)

Delete a QoS policy from an RSE.

Parameters:

Name Type Description Default
rse_id

The id of the RSE.

required
qos_policy str

The QoS policy to delete.

required
session

The database session in use.

required

Returns:

Type Description
Literal[True]

True if successful, silent failure if QoS policy does not exist.

list_qos_policies(rse)

List all QoS policies of an RSE.

Parameters:

Name Type Description Default
rse_id

The id of the RSE.

required
session

The database session in use.

required

Returns:

Type Description
list[str]

List containing all QoS policies.

set_rse_usage(rse, source, used, free, files=None)

Set RSE usage information.

Parameters:

Name Type Description Default
rse str

the RSE name.

required
source str

the information source, e.g. srm.

required
used int

the used space in bytes.

required
free int

the free in bytes.

required
files Optional[int]

the number of files

None

Returns:

Type Description
Literal[True]

True if successful

get_rse_usage(rse, filters=None)

Get RSE usage information.

Parameters:

Name Type Description Default
rse str

the RSE name.

required
filters Optional[dict[str, Any]]

dictionary of attributes by which the results should be filtered

None

Returns:

Type Description
Iterator[dict[str, Any]]

True if successful, otherwise false.

list_rse_usage_history(rse, filters=None)

List RSE usage history information.

Parameters:

Name Type Description Default
rse str

The RSE name.

required
filters Optional[dict[str, Any]]

dictionary of attributes by which the results should be filtered.

None

Returns:

Type Description
Iterator[dict[str, Any]]

list of dictionaries.

set_rse_limits(rse, name, value)

Set RSE limit information.

Parameters:

Name Type Description Default
rse str

The RSE name.

required
name str

The name of the limit.

required
value int

The feature value.

required

Returns:

Type Description
Literal[True]

True if successful

get_rse_limits(rse)

Get RSE limits.

Parameters:

Name Type Description Default
rse str

The RSE name.

required

Returns:

Type Description
Iterator[dict[str, Union[str, int]]]

An iterator of RSE limits as dicts with 'name' and 'value' as keys.

delete_rse_limits(rse, name)

Delete RSE limit information.

Parameters:

Name Type Description Default
rse str

The RSE name.

required
name str

The name of the limit.

required

Returns:

Type Description
Literal[True]

True if successful

add_distance(source, destination, parameters)

Add a src-dest distance.

Parameters:

Name Type Description Default
source str

The source.

required
destination str

The destination.

required
parameters dict[str, int]

A dictionary with property.

required

update_distance(source, destination, parameters)

Update distances with the given RSE ids.

Parameters:

Name Type Description Default
source str

The source.

required
destination str

The destination.

required
parameters dict[str, int]

A dictionary with property.

required

get_distance(source, destination)

Get distances between rses.

Parameters:

Name Type Description Default
source str

The source RSE.

required
destination str

The destination RSE.

required

Returns:

Type Description
list[dict[str, Union[str, int]]]

List of dictionaries.

delete_distance(source, destination)

Delete distances with the given RSE ids.

Parameters:

Name Type Description Default
source str

The source.

required
destination str

The destination.

required