Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx authored Sep 25, 2024
1 parent b12383c commit 6b26525
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions straxen/config/preprocessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def sort_url_kwargs(url: str):
if isinstance(url, str) and URLConfig.SCHEME_SEP in url:
if url != URLConfig.format_url_kwargs(url) and WARN:
warnings.warn(
"From straxen version 2.1.0 onward, URLConfig parameters"
"will be sorted alphabetically before being passed to the plugins,"
" this will change the lineage hash for non-sorted URLs. To load"
" data processed with non-sorted URLs, you will need to use an"
" older version."
"From straxen version 2.1.0 onward, URLConfig parameters "
"will be sorted alphabetically before being passed to the plugins, "
"this will change the lineage hash for non-sorted URLs. To load "
"data processed with non-sorted URLs, you will need to use an "
"older version."
)

WARN = False
Expand Down
2 changes: 1 addition & 1 deletion straxen/scripts/refresh_raw_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def main():
##
folder = st.storage[0].find(st.key_for(run_id, "raw_records"), fuzzy_for="raw_records")[1]
md = st.get_metadata(run_id, "raw_records")
metadata_fn = os.path.join(folder, strax.dirname_to_prefix(folder) + "-metadata.json")
metadata_fn = os.path.join(folder, strax.RUN_METADATA_PATTERN % strax.dirname_to_prefix(folder))
assert osp.exists(metadata_fn)
dtype = np.dtype(literal_eval(md["dtype"]))
record_length = strax.record_length_from_dtype(dtype)
Expand Down
2 changes: 1 addition & 1 deletion straxen/storage/rucio_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def __init__(self, rucio_dir, *args, **kwargs):
def _get_metadata(self, did: str, **kwargs):
scope, name = did.split(":")
number, dtype, hsh = parse_rucio_did(did)
metadata_json = f"{dtype}-{hsh}-metadata.json"
metadata_json = strax.RUN_METADATA_PATTERN % f"{dtype}-{hsh}"
metadata_did = f"{scope}:{metadata_json}"

metadata_path = rucio_path(self.rucio_dir, metadata_did)
Expand Down
2 changes: 1 addition & 1 deletion straxen/storage/rucio_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _get_metadata(self, dset_did, **kwargs):
rse = admix.downloader.determine_rse(rses)
self.dset_cache[dset_did] = rse

metadata_did = f"{dset_did}-metadata.json"
metadata_did = strax.RUN_METADATA_PATTERN % dset_did
downloaded = admix.download(metadata_did, rse=rse, location=self.staging_dir)
if len(downloaded) != 1:
raise ValueError(f"{metadata_did} should be a single file. We found {len(downloaded)}.")
Expand Down
2 changes: 1 addition & 1 deletion tests/storage/test_rucio_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def write_test_data(self):

@staticmethod
def write_md(rucio_path, did, content: dict):
md_did = f"{did}-metadata.json"
md_did = strax.RUN_METADATA_PATTERN % did
md_path = straxen.storage.rucio_local.rucio_path(rucio_path, md_did)
os.makedirs(os.path.split(md_path)[0], exist_ok=True)
with open(md_path, mode="w") as f:
Expand Down

0 comments on commit 6b26525

Please sign in to comment.