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:
|
RETURNS | DESCRIPTION |
---|---|
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:
|
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 |
---|---|
True if RSE 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 RSE.
TYPE:
|
parameters
|
A dictionary with property (name, read, write, delete as keys).
TYPE:
|
delete_rse ¶
delete_rse(rse)
Sends the request to delete a rse.
PARAMETER | DESCRIPTION |
---|---|
rse
|
The name of the RSE.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
True if RSE was deleted successfully else False.
|
|
list_rses ¶
list_rses(rse_expression=None)
Sends the request to list all rucio locations(RSEs).
PARAMETER | DESCRIPTION |
---|---|
rse_expression
|
RSE expression to use as filter.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
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:
|
key
|
The attribute key.
TYPE:
|
value
|
The attribute value.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
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:
|
key
|
The attribute key.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
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:
|
RETURNS | DESCRIPTION |
---|---|
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:
|
params
|
Attributes of the protocol. Supported are: - scheme: identifier of this protocol - hostname: hostname for this protocol (default = localhost) - port: port for this protocol (default = 0) - prefix: string used as a prefix 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 protocol for read operations (default = -1) - write: integer representing the priority of this protocol for write operations (default = -1) - delete: integer representing the priority of this protocol for delete operations (default = -1) - extended_attributes: miscellaneous protocol specific information e.g. spacetoken for SRM (default = None)
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
True if protocol was created successfully.
|
|
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 mandatory 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:
|
protocol_domain
|
The scope of the protocol. Supported are 'LAN', 'WAN', and 'ALL', by default 'ALL'.
TYPE:
|
operation
|
The name of the requested operation (read, write, or delete). If None, all operations are queried, by default None.
TYPE:
|
default
|
Indicates if only the default operations should be returned, by default False.
TYPE:
|
scheme
|
The identifier of the requested protocol, by default None.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
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:
|
lfns
|
A list of LFN strings to translate to PFNs.
TYPE:
|
protocol_domain
|
The scope of the protocol.
TYPE:
|
operation
|
The name of the requested operation (read, write, or delete). If None, all operations are queried, by default None.
TYPE:
|
scheme
|
The identifier of the requested protocol (gsiftp, https, davs, etc), by default None.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
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:
|
scheme
|
The identifier of the protocol.
TYPE:
|
hostname
|
The hostname of the protocol.
TYPE:
|
port
|
The port of the protocol.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
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:
|
scheme
|
The identifier of the protocol.
TYPE:
|
data
|
A dict providing the new values of the protocol attributes. Keys must match column names in database.
TYPE:
|
hostname
|
The hostname of the protocol.
TYPE:
|
port
|
The port of the protocol.
TYPE:
|
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:
|
domain
|
The domain in which priorities should be swapped (e.g., 'wan' or 'lan').
TYPE:
|
operation
|
The operation for which priorities should be swapped (e.g., 'read', 'write', or 'delete').
TYPE:
|
scheme_a
|
The scheme of one of the two protocols to be swapped (e.g., 'srm').
TYPE:
|
scheme_b
|
The scheme of the other protocol to be swapped (e.g., 'http').
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
True if successful.
|
|
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 to an RSE.
PARAMETER | DESCRIPTION |
---|---|
rse
|
The name of the RSE.
TYPE:
|
qos_policy
|
The QoS policy to add.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
True if successful.
|
|
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
|
The name of the RSE.
TYPE:
|
qos_policy
|
The QoS policy to delete.
TYPE:
|
session
|
The database session in use.
|
RETURNS | DESCRIPTION |
---|---|
True if successful.
|
|
RAISES | DESCRIPTION |
---|---|
RSENotFound
|
If the RSE doesn't exist. |
QoSPolicyNotFound
|
If the QoS policy doesn't exist. |
list_qos_policies ¶
list_qos_policies(rse)
List all QoS policies of an RSE.
:param rse_id: The id of the RSE. :param session: The database session in use.
:returns: 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:
|
source
|
The information source, e.g. srm.
TYPE:
|
used
|
The used space in bytes.
TYPE:
|
free
|
The free space in bytes.
TYPE:
|
files
|
The number of files.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
True if successful.
|
|
get_rse_usage ¶
get_rse_usage(rse, filters=None)
Get RSE usage information.
PARAMETER | DESCRIPTION |
---|---|
rse
|
The RSE name.
TYPE:
|
filters
|
dictionary of attributes by which the results should be filtered
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
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:
|
filters
|
dictionary of attributes by which the results should be filtered
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list of dictionaries
|
|
set_rse_limits ¶
set_rse_limits(rse, name, value)
Set RSE limit information.
PARAMETER | DESCRIPTION |
---|---|
rse
|
The RSE name.
TYPE:
|
name
|
The name of the limit.
TYPE:
|
value
|
The feature value.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
True if successful.
|
|
get_rse_limits ¶
get_rse_limits(rse)
Get RSE limits.
PARAMETER | DESCRIPTION |
---|---|
rse
|
The RSE name.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
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:
|
name
|
The name of the limit.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
True if successful.
|
|
add_distance ¶
add_distance(source, destination, parameters)
Add a src-dest distance.
:param source: The source. :param destination: The destination. :param parameters: A dictionary with property.
update_distance ¶
update_distance(source, destination, parameters)
Update distances with the given RSE ids.
PARAMETER | DESCRIPTION |
---|---|
source
|
The source RSE.
TYPE:
|
destination
|
The destination RSE.
TYPE:
|
parameters
|
A dictionary with property
TYPE:
|
get_distance ¶
get_distance(source, destination)
Get distances between rses.
Param
source : The source RSE. destination :
The destination RSE.
RETURNS | DESCRIPTION |
---|---|
A list of dictionaries with the distance information.
|
|
delete_distance ¶
delete_distance(source, destination)
Delete distances with the given RSE ids.
PARAMETER | DESCRIPTION |
---|---|
source
|
The source
TYPE:
|
destination
|
The destination
TYPE:
|