Skip to content

Rseclient

Classes

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

Functions

get_rse
get_rse(rse)

Returns details about the referred RSE.

PARAMETER DESCRIPTION
rse

Name of the referred RSE

TYPE: str

RETURNS DESCRIPTION
dict[str, Any]

A dict containing all attributes of the referred RSE

RAISES DESCRIPTION
RSENotFound

if the referred RSE was not found in the database

add_rse
add_rse(rse, **kwargs)

Sends the request to create a new RSE.

PARAMETER DESCRIPTION
rse

the name of the rse.

TYPE: str

deterministic

Boolean to know if the pfn is generated deterministically.

volatile

Boolean for RSE cache.

city

City for the RSE.

region_code

The region code for the RSE.

country_name

The country.

continent

The continent.

time_zone

Timezone.

staging_area

Staging area.

ISP

Internet service provider.

rse_type

RSE type.

latitude

Latitude coordinate of RSE.

longitude

Longitude coordinate of RSE.

ASN

Access service network.

availability

Availability.

RETURNS DESCRIPTION
Literal[True]

True if location was created successfully else False.

RAISES DESCRIPTION
Duplicate

if rse already exists.

update_rse
update_rse(rse, parameters)

Update RSE properties like availability or name.

PARAMETER DESCRIPTION
rse

the name of the new rse.

TYPE: str

parameters

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

delete_rse
delete_rse(rse)

Sends the request to delete a rse.

PARAMETER DESCRIPTION
rse

the name of the rse.

TYPE: str

RETURNS DESCRIPTION
Literal[True]

True if location was created successfully else False.

list_rses
list_rses(rse_expression=None)

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

:rse_expression: RSE Expression to use as filter.

RETURNS DESCRIPTION
Iterator[dict[str, Any]]

a list containing the names of all rucio locations.

add_rse_attribute
add_rse_attribute(rse, key, value)

Sends the request to add a RSE attribute.

PARAMETER DESCRIPTION
rse

the name of the rse.

TYPE: str

key

the attribute key.

TYPE: str

value

the attribute value.

TYPE: Any

RETURNS DESCRIPTION
Literal[True]

True if RSE attribute was created successfully else False.

RAISES DESCRIPTION
Duplicate

if RSE attribute already exists.

delete_rse_attribute
delete_rse_attribute(rse, key)

Sends the request to delete a RSE attribute.

PARAMETER DESCRIPTION
rse

the RSE name.

TYPE: str

key

the attribute key.

TYPE: str

RETURNS DESCRIPTION
Literal[True]

True if RSE attribute was deleted successfully else False.

list_rse_attributes
list_rse_attributes(rse)

Sends the request to get RSE attributes.

PARAMETER DESCRIPTION
rse

The RSE name.

TYPE: str

RETURNS DESCRIPTION
dict[str, Any]

A dict with the RSE attribute name/value pairs.

add_protocol
add_protocol(rse, params)

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

PARAMETER DESCRIPTION
rse

the name of the rse.

TYPE: str

scheme

identifier of this protocol

params

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)

TYPE: dict[str, Any]

RETURNS DESCRIPTION
Literal[True]

True if protocol was created successfully else False.

RAISES 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
get_protocols(
    rse,
    protocol_domain="ALL",
    operation=None,
    default=False,
    scheme=None,
)

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

PARAMETER DESCRIPTION
rse

the RSE name.

TYPE: str

protocol_domain

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

TYPE: RSE_SUPPORTED_PROTOCOL_DOMAINS_LITERAL DEFAULT: 'ALL'

operation

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

TYPE: Optional[RSE_ALL_SUPPORTED_PROTOCOL_OPERATIONS_LITERAL] DEFAULT: None

default

Indicates if only the default operations should be returned.

TYPE: bool DEFAULT: False

scheme

The identifier of the requested protocol.

TYPE: Optional[SUPPORTED_PROTOCOLS_LITERAL] DEFAULT: None

RETURNS DESCRIPTION
Any

A dict with details about each matching protocol.

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

PARAMETER DESCRIPTION
rse

the RSE name

TYPE: str

lfns

A list of LFN strings to translate to PFNs.

TYPE: Iterable[str]

protocol_domain

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

TYPE: RSE_SUPPORTED_PROTOCOL_DOMAINS_LITERAL DEFAULT: 'ALL'

operation

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

TYPE: Optional[RSE_ALL_SUPPORTED_PROTOCOL_OPERATIONS_LITERAL] DEFAULT: None

scheme

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

TYPE: Optional[SUPPORTED_PROTOCOLS_LITERAL] DEFAULT: None

RETURNS DESCRIPTION
dict[str, str]

A dictionary of LFN / PFN pairs.

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

PARAMETER DESCRIPTION
rse

the RSE name.

TYPE: str

scheme

identifier of the protocol.

TYPE: SUPPORTED_PROTOCOLS_LITERAL

hostname

hostname of the protocol.

TYPE: Optional[str] DEFAULT: None

port

port of the protocol.

TYPE: Optional[int] DEFAULT: None

RETURNS DESCRIPTION
Literal[True]

True if success.

RAISES DESCRIPTION
RSEProtocolNotSupported

if no matching protocol entry could be found.

RSENotFound

if the RSE doesn't exist.

AccessDenied

if not authorized.

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

PARAMETER DESCRIPTION
rse

the RSE name.

TYPE: str

scheme

identifier of the protocol.

TYPE: SUPPORTED_PROTOCOLS_LITERAL

data

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

TYPE: dict[str, Any]

hostname

hostname of the protocol.

TYPE: Optional[str] DEFAULT: None

port

port of the protocol.

TYPE: Optional[int] DEFAULT: None

RETURNS DESCRIPTION

True if success.

RAISES 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
swap_protocols(rse, domain, operation, scheme_a, scheme_b)

Swaps the priorities of the provided operation.

PARAMETER DESCRIPTION
rse

the RSE name.

TYPE: str

domain

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

TYPE: RSE_SUPPORTED_PROTOCOL_DOMAINS_LITERAL

operation

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

TYPE: RSE_ALL_SUPPORTED_PROTOCOL_OPERATIONS_LITERAL

scheme_a

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

TYPE: SUPPORTED_PROTOCOLS_LITERAL

scheme_b

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

TYPE: SUPPORTED_PROTOCOLS_LITERAL

RETURNS DESCRIPTION
bool

True if success.

RAISES 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
add_qos_policy(rse, qos_policy)

Add a QoS policy from an RSE.

PARAMETER DESCRIPTION
rse_id

The id of the RSE.

qos_policy

The QoS policy to add.

TYPE: str

session

The database session in use.

RETURNS DESCRIPTION
Literal[True]

True if successful, except otherwise.

RAISES DESCRIPTION
Duplicate

If the QoS policy already exists.

delete_qos_policy
delete_qos_policy(rse, qos_policy)

Delete a QoS policy from an RSE.

PARAMETER DESCRIPTION
rse_id

The id of the RSE.

qos_policy

The QoS policy to delete.

TYPE: str

session

The database session in use.

RETURNS DESCRIPTION
Literal[True]

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

list_qos_policies
list_qos_policies(rse)

List all QoS policies of an RSE.

PARAMETER DESCRIPTION
rse_id

The id of the RSE.

session

The database session in use.

RETURNS DESCRIPTION
list[str]

List containing all QoS policies.

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

Set RSE usage information.

PARAMETER DESCRIPTION
rse

the RSE name.

TYPE: str

source

the information source, e.g. srm.

TYPE: str

used

the used space in bytes.

TYPE: int

free

the free in bytes.

TYPE: int

files

the number of files

TYPE: Optional[int] DEFAULT: None

RETURNS DESCRIPTION
Literal[True]

True if successful

get_rse_usage
get_rse_usage(rse, filters=None)

Get RSE usage information.

PARAMETER DESCRIPTION
rse

the RSE name.

TYPE: str

filters

dictionary of attributes by which the results should be filtered

TYPE: Optional[dict[str, Any]] DEFAULT: None

RETURNS DESCRIPTION
Iterator[dict[str, Any]]

True if successful, otherwise false.

list_rse_usage_history
list_rse_usage_history(rse, filters=None)

List RSE usage history information.

PARAMETER DESCRIPTION
rse

The RSE name.

TYPE: str

filters

dictionary of attributes by which the results should be filtered.

TYPE: Optional[dict[str, Any]] DEFAULT: None

RETURNS DESCRIPTION
Iterator[dict[str, Any]]

list of dictionaries.

set_rse_limits
set_rse_limits(rse, name, value)

Set RSE limit information.

PARAMETER DESCRIPTION
rse

The RSE name.

TYPE: str

name

The name of the limit.

TYPE: str

value

The feature value.

TYPE: int

RETURNS DESCRIPTION
Literal[True]

True if successful

get_rse_limits
get_rse_limits(rse)

Get RSE limits.

PARAMETER DESCRIPTION
rse

The RSE name.

TYPE: str

RETURNS DESCRIPTION
Iterator[dict[str, Union[str, int]]]

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

delete_rse_limits
delete_rse_limits(rse, name)

Delete RSE limit information.

PARAMETER DESCRIPTION
rse

The RSE name.

TYPE: str

name

The name of the limit.

TYPE: str

RETURNS DESCRIPTION
Literal[True]

True if successful

add_distance
add_distance(source, destination, parameters)

Add a src-dest distance.

PARAMETER DESCRIPTION
source

The source.

TYPE: str

destination

The destination.

TYPE: str

parameters

A dictionary with property.

TYPE: dict[str, int]

update_distance
update_distance(source, destination, parameters)

Update distances with the given RSE ids.

PARAMETER DESCRIPTION
source

The source.

TYPE: str

destination

The destination.

TYPE: str

parameters

A dictionary with property.

TYPE: dict[str, int]

get_distance
get_distance(source, destination)

Get distances between rses.

PARAMETER DESCRIPTION
source

The source RSE.

TYPE: str

destination

The destination RSE.

TYPE: str

RETURNS DESCRIPTION
list[dict[str, Union[str, int]]]

List of dictionaries.

delete_distance
delete_distance(source, destination)

Delete distances with the given RSE ids.

PARAMETER DESCRIPTION
source

The source.

TYPE: str

destination

The destination.

TYPE: str

Functions