Skip to content

Commit

Permalink
Check RSE in _find method of RucioRemoteFrontend (#1464)
Browse files Browse the repository at this point in the history
* Check RSE in `_find` method of `RucioRemoteFrontend`

* Debug
  • Loading branch information
dachengx authored Nov 7, 2024
1 parent d78177f commit f1bb229
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions straxen/storage/rucio_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(
else:
self.log.warning(
"You passed use_remote=True to rucio fronted, "
"but you don't have access to admix/rucio! Using local backed only."
"but you don't have access to admix/rucio! Using local backend only."
)

def find_several(self, keys, **kwargs):
Expand All @@ -71,9 +71,10 @@ def _find(self, key: strax.DataKey, write, allow_incomplete, fuzzy_for, fuzzy_fo
"continuous"
)
try:
rules = admix.rucio.list_rules(did, state="OK")
if len(rules):
return "RucioRemoteBackend", did
for b in self.backends:
rse = b._get_rse(did, state="OK")
if rse:
return "RucioRemoteBackend", did
except DataIdentifierNotFound:
pass

Expand Down Expand Up @@ -120,7 +121,7 @@ def __init__(self, staging_dir, download_heavy=False, rses_only=tuple(), **kwarg
self.download_heavy = download_heavy
self.rses_only = strax.to_str_tuple(rses_only)

def _get_rse(self, dset_did):
def _get_rse(self, dset_did, **filters):
"""Determine the appropriate Rucio Storage Element (RSE) for a dataset.
:param dset_did (str) :The dataset identifier.
Expand All @@ -129,7 +130,7 @@ def _get_rse(self, dset_did):
Uses self.rses_only to filter available RSEs if set.
"""
rses = admix.rucio.get_rses(dset_did)
rses = admix.rucio.get_rses(dset_did, **filters)
rses = list(set(rses) & set(self.rses_only)) if self.rses_only else rses
rse = admix.downloader.determine_rse(rses)
return rse
Expand Down

0 comments on commit f1bb229

Please sign in to comment.