Skip to content

Commit

Permalink
Add nwb path in cache
Browse files Browse the repository at this point in the history
  • Loading branch information
bjhardcastle committed Apr 18, 2024
1 parent a0ce465 commit 58c9a06
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/npc_lims/paths/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@
v.startswith(".") for v in CACHED_FILE_EXTENSIONS.values()
), "CACHED_FILE_EXTENSIONS must have values that start with a period"

def get_nwb_path(
session_id: str | npc_session.SessionRecord,
version: str | None = None,
) -> upath.UPath:
"""
>>> get_nwb_path("366122_2023-12-31") # doctest: +SKIP
S3Path('s3://aind-scratch-data/ben.hardcastle/nwb/v0.0.210/366122_2023-12-31.nwb.zarr')
>>> get_nwb_path("366122_2023-12-31", version="v0.0.0")
S3Path('s3://aind-scratch-data/ben.hardcastle/nwb/v0.0.0/366122_2023-12-31.nwb.zarr')
"""
if version is not None:
try:
version = _parse_version(version)
except ValueError:
version = version
else:
version = get_current_cache_version()
return S3_SCRATCH_ROOT / "nwb" / version / f"{npc_session.SessionRecord(session_id)}.nwb.zarr"

def get_cache_file_suffix(nwb_component: NWBComponentStr) -> str:
"""
Expand Down

0 comments on commit 58c9a06

Please sign in to comment.