Skip to content

Commit

Permalink
reinstated commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed May 24, 2024
1 parent a55fc57 commit 2fa6272
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions xnat_ingest/cli/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,19 @@ def iter_staged_sessions():
# we recreate the project/subject/sesssion directory structure
session_tmp_dir = tmp_download_dir.joinpath(*ids)
session_tmp_dir.mkdir(parents=True, exist_ok=True)
# for relpath, obj in tqdm(
# objs,
# desc=f"Downloading scans in {':'.join(ids)} session from S3 bucket",
# ):
# obj_path = session_tmp_dir.joinpath(*relpath)
# obj_path.parent.mkdir(parents=True, exist_ok=True)
# logger.debug("Downloading %s to %s", obj, obj_path)
# with open(obj_path, "wb") as f:
# bucket.download_fileobj(obj.key, f)
for relpath, obj in tqdm(
objs,
desc=f"Downloading scans in {':'.join(ids)} session from S3 bucket",
):
obj_path = session_tmp_dir.joinpath(*relpath)
obj_path.parent.mkdir(parents=True, exist_ok=True)
logger.debug("Downloading %s to %s", obj, obj_path)
with open(obj_path, "wb") as f:
bucket.download_fileobj(obj.key, f)
yield session_tmp_dir
# shutil.rmtree(
# session_tmp_dir
# ) # Delete the tmp session after the upload
shutil.rmtree(
session_tmp_dir
) # Delete the tmp session after the upload

logger.info("Found %d sessions in S3 bucket '%s'", num_sessions, staged)
sessions = iter_staged_sessions()
Expand Down

0 comments on commit 2fa6272

Please sign in to comment.