Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit b41053a

Browse files
committed
fix: changed the progress bar label a bit and skip any empty directories
1 parent e29ebbb commit b41053a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

dmriprep/cli.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,11 @@ def upload(output_dir, bucket, access_key, secret_key, provider='s3', subject=No
9393
def upload_subject(sub, sub_idx):
9494
base_dir = os.path.join(output_dir, sub, 'dmriprep')
9595
for root, dirs, files in os.walk(base_dir):
96-
for f in tqdm(files, desc=f"Uploading {sub}", position=sub_idx):
97-
filepath = os.path.join(root, f)
98-
key = root.replace(output_dir, '')
99-
client.upload_file(filepath, bucket, os.path.join(key, f))
96+
if len(files):
97+
for f in tqdm(files, desc=f"Uploading {sub} {root.split('/')[-1]}", position=sub_idx):
98+
filepath = os.path.join(root, f)
99+
key = root.replace(output_dir, '')
100+
client.upload_file(filepath, bucket, os.path.join(key, f))
100101

101102
uploads = [delayed(upload_subject)(s, idx) for idx, s in enumerate(subjects)]
102103
_ = list(compute(*uploads, scheduler="threads"))

0 commit comments

Comments
 (0)