-
Notifications
You must be signed in to change notification settings - Fork 306
Show dialog before download #287
Show dialog before download #287
Conversation
Also, I would be against asking users to confirm download. |
@@ -51,12 +55,12 @@ def cached_download(url): | |||
str: Path to the downloaded file. | |||
|
|||
""" | |||
cache_root = get_dataset_directory('_dl_cache') | |||
cache_root = os.path.join(get_dataset_root(), '_dl_cache') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, the following try, except were not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change necessary?
I followed this discussion chainer/chainer#2839 (comment). This change is not related to this issue directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
We can divide this problem into two.
|
I find it irritating to find my process hang because of this feature. |
OK, I removed confirmation step and changed the progress message as follows.
|
OK. Thanks. |
I added.
|
On downloading message, I think it is too verbose. Four suggestions
Here is a code I suggest to use from line 32. eta = (total_size - progress_size) / speed
sys.stdout.write(
'\r... {:.0f}% {:.0f}MiB/{:.0f}MiB '
'{:.0f}KiB/s eta {:.0f}m {:.0f}s'
.format(
percent, progress_size / (1 << 20), total_size / (1 << 20),
speed / (1 << 10), eta // 60, eta % 60)) The message looks something like below.
|
This is something different from what I have said in the last comment, but how about switching eta to sys.stdout.write(
'\r... {:3.0f}% Total {:7.0f}Mib Current {:7.0f}MiB '
'{:8.0f}KiB/s eta {:5.0f}:{:02.0f}:{:02.0f}'
.format(
percent, total_size / (1 << 20), progress_size / (1 << 20),
speed / (1 << 10), eta // 3600, eta // 60, eta % 60))
Edit: I tweaked more, and I found that it looks nice to report only percentage, speed and eta. def _reporthook(count, block_size, total_size):
global start_time
if count == 0:
start_time = time.time()
print('Total size {:.0f}Mib'.format(total_size / (1 << 20)))
return
duration = time.time() - start_time
progress_size = count * block_size
try:
speed = progress_size / duration
except ZeroDivisionError:
speed = float('inf')
percent = progress_size / total_size * 100
eta = (total_size - progress_size) / speed
sys.stdout.write(
'\r... {:3.0f}% '
'{:8.0f}KiB/s {:5.0f}h {:2.0f}m {:2.0f}s left'
.format(
percent,
speed / (1 << 10), eta // 3600, eta // 60, eta % 60))
sys.stdout.flush()
The message
|
From my understanding, the original issue is that users can not know the total dataset size #286. I think it is better to show the total size and downloaded size. |
I don't like either. I accept your modification about the length. |
@yuyu2172 How about this output?
This format is inspired by curl command. |
LGTM |
Fix #286