Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@HippocampusGirl
Copy link
Contributor

When downloading files, the progress display shows file sizes on the order of kilobytes, even though the requested file should be multiple megabytes in size. When I first encountered this, I thought the files may be corrupt, but this is not the case.

Downloading https://templateflow.s3.amazonaws.com/tpl-MNI152NLin2009cAsym/tpl-MNI152NLin2009cAsym_res-01_desc-brain_T1w.nii.gz
3.39kB [00:00, 3.46kB/s]

Steps to reproduce this

import os
from tempfile import mkdtemp
os.environ["TEMPLATEFLOW_HOME"] = mkdtemp()

from templateflow import api
api.get("MNI152NLin2009cAsym", resolution=1, desc="brain", suffix="T1w")

Looking at the code, I discovered that the progress bar module tqdm is configured to display one download block as one byte, even though one download block can be up to 1024 bytes in size.

With the proposed fix, the correct file size is displayed

Downloading https://templateflow.s3.amazonaws.com/tpl-MNI152NLin2009cAsym/tpl-MNI152NLin2009cAsym_res-01_desc-brain_T1w.nii.gz
100%|████████████████████████████████████████████████████████████| 3.47M/3.47M [00:01<00:00, 3.46MB/s]

@oesteban
Copy link
Member

I'm going to break master by merging this, but that should be easily solvable if we do this -> nipreps/sdcflows@fef4ac6

Thanks much for this contribution!!

@oesteban oesteban merged commit 6857754 into templateflow:master Oct 19, 2020
@HippocampusGirl HippocampusGirl deleted the progress-bar-units branch October 19, 2020 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants