Skip to content

Commit

Permalink
Fix dmwm#837: Distances for Europe and Asia
Browse files Browse the repository at this point in the history
Set distances between:
A (West Europe) and C (East Europe) regions to 11
C (East Europe) and D (Asia) regions to 12
  • Loading branch information
d-ylee committed Oct 15, 2024
1 parent 11aa263 commit 20fb8e4
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions docker/rucio_client/scripts/cmslinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
And script for updating the distances.
"""
import gitlab
import base64

import argparse
import base64
import json
import logging
import os
Expand All @@ -16,7 +17,7 @@

DEFAULT_EXCLUDE_LINKS = (
{'dest': {'type': 'temp'}, 'src': {}},
{'dest': {'rse': 'T2_US_Caltech'}, 'src': {'rse': 'T2_US_Caltech_Ceph'}},
{'dest': {'rse': 'T2_US_Caltech'}, 'src': {'rse': 'T2_US_Caltech_Ceph'}}, # TODO: Temporary site, Clear up
{'dest': {'rse': 'T1_UK_RAL_Tape_Test'}, 'src': {}},
{'dest': {}, 'src': {'rse': 'T1_UK_RAL_Tape_Test'}},
{'dest': {'rse': 'T1_UK_RAL_Tape'}, 'src': {'rse': '^(?!T1_UK_RAL_Disk|T0_CH_CERN_Disk).*$'}},
Expand All @@ -26,7 +27,17 @@
CTA_RSES = ['T0_CH_CERN_Tape']
CERN_RSES = ['T2_CH_CERN']

DEFAULT_DISTANCE_RULES = {'site': 1, 'region&country': 4, 'country': 7, 'region': 10, 'other': 13}
# TODO: Regions A and C should be 11
# TODO: Regions C and D should be 12
DEFAULT_DISTANCE_RULES = {
'site': 1,
'region&country': 4,
'country': 7,
'region': 10,
'AC': 11,
'CD': 12,
'other': 13
}


class LinksMatrix(object):
Expand Down Expand Up @@ -101,32 +112,38 @@ def _get_rselist(self, rselist=None):

def _get_matrix(self, distance, exclude):

# TODO: Unused?
matrix = {}

self.links = {}

for src in self.rselist:
for src in self.rselist: # get the list
for dest in self.rselist:

src_rse = src['rse']
dest_rse = dest['rse']
src_pnn = src['pnn']
dest_pnn = dest['pnn']

# TODO: If region A and region C, set to 11
# TODO: Region C and D: 12
if dest_pnn == src_pnn:
link = distance['site']
elif src['region'] and dest['region'] and src['region'] == dest['region']:
if src['country'] == dest['country']:
elif src['region'] and dest['region'] and src['region'] == dest['region']: # Check same region
if src['country'] == dest['country']: # Same country and region
link = distance['region&country']
else:
link = distance['region']
elif src_pnn in matrix and dest_pnn in matrix[src_pnn]:
elif src_pnn in matrix and dest_pnn in matrix[src_pnn]: # not sure what this is for
link = distance['site'] - matrix[src_pnn][dest_pnn]
elif src['country'] == dest['country']:
link = distance['country']
elif {src['region'], dest['region']} == {'A', 'C'}:
link = distance['AC']
elif {src['region'], dest['region']} == {'C', 'D'}:
link = distance['CD']
else:
if src['country'] == dest['country']:
link = distance['country']
else:
link = distance['other']
link = distance['other']

if src_rse not in self.links:
self.links[src_rse] = {}
Expand All @@ -136,6 +153,9 @@ def _get_matrix(self, distance, exclude):
self._filter_matrix(exclude)

def _filter_matrix(self, exclude):
"""
Removes links from list of excluded
"""

for src in self.rselist:
for dest in self.rselist:
Expand Down

0 comments on commit 20fb8e4

Please sign in to comment.