Skip to content

Commit

Permalink
Merge 69df71e into 3258746
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx committed Aug 29, 2023
2 parents 3258746 + 69df71e commit 48ac7ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions straxen/contexts.py
Expand Up @@ -158,6 +158,7 @@ def xenonnt_online(output_folder: str = './strax_data',
_auto_append_rucio_local: bool = True,
_rucio_path: str = '/dali/lgrandi/rucio/',
_rucio_local_path: ty.Optional[str] = None,
_find_in_storage: bool = False,
_raw_paths: ty.Optional[str] = ['/dali/lgrandi/xenonnt/raw'],
_processed_paths: ty.Optional[ty.List[str]] = ['/dali/lgrandi/xenonnt/processed',
'/project2/lgrandi/xenonnt/processed',
Expand Down Expand Up @@ -224,6 +225,7 @@ def xenonnt_online(output_folder: str = './strax_data',
runid_field='number',
new_data_path=output_folder,
rucio_path=_rucio_path,
find_in_storage=_find_in_storage,
)] if _database_init else []
if not we_are_the_daq:
for _raw_path in _raw_paths:
Expand Down
9 changes: 9 additions & 0 deletions straxen/storage/rundb.py
Expand Up @@ -42,6 +42,7 @@ def __init__(self,
new_data_path=None,
reader_ini_name_is_mode=False,
rucio_path=None,
find_in_storage=False,
mongo_url=None,
mongo_user=None,
mongo_password=None,
Expand Down Expand Up @@ -81,6 +82,7 @@ def __init__(self,
if self.new_data_path is None:
self.readonly = True
self.runid_field = runid_field
self.find_in_storage = find_in_storage

if self.runid_field not in ['name', 'number']:
raise ValueError("Unrecognized runid_field option %s" % self.runid_field)
Expand Down Expand Up @@ -230,6 +232,13 @@ def _find(self, key: strax.DataKey,
return datum['protocol'], datum['location']

def find_several(self, keys: typing.List[strax.DataKey], **kwargs):
"""Find several keys at once.
If find_in_storage is True, will only check the storage backend,
because sometimes the RunDB docs indicate more docs than the available servers.
"""
if self.find_in_storage:
return super().find_several(keys, **kwargs)

if kwargs.get('fuzzy_for', False) or kwargs.get('fuzzy_for_options', False):
warnings.warn("Can't do fuzzy with RunDB yet. Only returning exact matches")
if not keys:
Expand Down

0 comments on commit 48ac7ea

Please sign in to comment.