Commit da1fe172 authored by James Clark's avatar James Clark
Browse files

tool to use rse client to set all distances to unity

parent 29e9785d
Pipeline #82891 passed with stages
in 1 minute and 3 seconds
#/bin/sh -e
rucio-admin rse add-distance --distance 1 --ranking 1 $1 $2
rucio-admin rse add-distance --distance 1 --ranking 1 $2 $1
......@@ -2,10 +2,40 @@
"""rse_distances
Sets distances and rankings for all RSEs to unity
"""
from rucio.core.distance import add_distance
from rucio.core.rse import list_rses
rses = list_rses()
for src in rses:
for dst in rses:
add_distance(src_rse_id=src['id'], dest_rse_id=dst['id'], ranking=1,
agis_distance=1)
from rucio.client.rseclient import RSEClient
import rucio.common.exception
def get_rse_list(client):
"""
Return a python list of RSEs
"""
return [r['rse'] for r in client.list_rses()]
def main():
"""Core functionality"""
rseclient = RSEClient()
rses = get_rse_list(rseclient)
for src in rses:
for dst in rses:
if src == dst:
continue
print("Setting {0}-{1} distance: 1".format(src, dst))
try:
rseclient.add_distance(source=src, destination=dst,
parameters={'distance': 1,
'ranking': 1})
except rucio.common.exception.RucioException:
rseclient.update_distance(source=src, destination=dst,
parameters={'distance': 1,
'ranking': 1})
print("Distance:")
print(rseclient.get_distance(src, dst))
if __name__ == "__main__":
main()
#!/bin/sh -x
SRC=${HOME}/src/gwrucio/rses
${SRC}/rse_distance LIGO-CIT LIGO-CIT-ARCHIVE
${SRC}/rse_distance LIGO-CIT LIGO-WA
${SRC}/rse_distance LIGO-CIT LIGO-WA-ARCHIVE
${SRC}/rse_distance LIGO-CIT-ARCHIVE LIGO-WA
${SRC}/rse_distance LIGO-CIT-ARCHIVE LIGO-WA-ARCHIVE
${SRC}/rse_distance UNL LIGO-WA
${SRC}/rse_distance UNL LIGO-WA-ARCHIVE
${SRC}/rse_distance UNL LIGO-CIT
${SRC}/rse_distance UNL LIGO-CIT-ARCHIVE
${SRC}/rse_distance CNAF LIGO-WA
${SRC}/rse_distance CNAF LIGO-WA-ARCHIVE
${SRC}/rse_distance CNAF LIGO-CIT
${SRC}/rse_distance CNAF LIGO-CIT-ARCHIVE
${SRC}/rse_distance CNAF UNL
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment