Skip to content

Commit cc65790

Browse files
committed
the progressbar is now passed as an extra argument to wait_interactive
1 parent 4e84a01 commit cc65790

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

ipyparallel/client/asyncresult.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@
2828

2929
from .futures import MessageFuture
3030

31-
try:
32-
from tqdm import tqdm
33-
use_progressbar = True
34-
except ImportError:
35-
use_progressbar = False
36-
37-
3831
def _raw_text(s):
3932
display_pretty(s, raw=True)
4033

@@ -498,14 +491,18 @@ def wall_time(self):
498491
"""
499492
return self.timedelta(self.submitted, self.received)
500493

501-
def wait_interactive(self, interval=1., timeout=-1):
502-
"""interactive wait, printing progress at regular intervals"""
494+
def wait_interactive(self, interval=1., timeout=-1, progress=None):
495+
"""interactive wait, printing progress at regular intervals.
496+
497+
progress can be a tqdm-like progress bar."""
498+
499+
use_progressbar = progress is not None
503500
if timeout is None:
504501
timeout = -1
505502
N = len(self)
506503
tic = time.time()
507504
if use_progressbar:
508-
progress_bar = tqdm(total=N)
505+
progress_bar = progress(total=N)
509506
n_prev = 0
510507
while not self.ready() and (timeout < 0 or time.time() - tic <= timeout):
511508
self.wait(interval)

0 commit comments

Comments
 (0)