Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progressbar of download action in Jupyter notebook #576

Open
BoPeng opened this issue Apr 28, 2017 · 1 comment
Open

Progressbar of download action in Jupyter notebook #576

BoPeng opened this issue Apr 28, 2017 · 1 comment
Assignees

Comments

@BoPeng
Copy link
Contributor

BoPeng commented Apr 28, 2017

The progress bar is displayed on the console. We should replace it with the Jupyter implementation of tqdm ( #398 ) so that it can be displayed in Jupyter.

@BoPeng BoPeng self-assigned this Apr 28, 2017
@BoPeng
Copy link
Contributor Author

BoPeng commented Apr 30, 2017

Using tqdm_notebook as ProgressBar yields a lot of messages and no progress bar.

[IPKernelApp] WARNING | WARNING: attempted to send message from fork

Patch

diff --git a/sos/actions.py b/sos/actions.py
index 9b111cf..ae97c3c 100644
--- a/sos/actions.py
+++ b/sos/actions.py
@@ -41,7 +41,7 @@ from functools import wraps

 from collections.abc import Sequence
 import multiprocessing as mp
-from tqdm import tqdm as ProgressBar
+from tqdm import tqdm, tqdm_notebook
 from .utils import env, transcribe, AbortExecution, short_repr, get_traceback
 from .sos_eval import Undetermined, interpolate
 from .target import FileTarget, fileMD5, executable, UnknownTarget, BaseTarget
@@ -405,6 +405,8 @@ def downloadURL(URL, dest, decompress=False, index=None):
     #
     dest_tmp = dest + '.tmp_{}'.format(os.getpid())
     term_width = shutil.get_terminal_size((80, 20)).columns
+    ProgressBar = tqdm_notebook if env.config['run_mode'] == 'interactive' else tqdm
     try:
         env.logger.debug('Download {} to {}'.format(URL, dest))
         sig = FileTarget(dest)

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

No branches or pull requests

1 participant