Skip to content

Commit 32b558a

Browse files
authored
Merge pull request #257 from dansbecker/no-exception-parallel-without-fastprogress
Fixes #256
2 parents 74bfbb5 + 7da6374 commit 32b558a

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

fastcore/parallel.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,10 @@ def map(self, f, items, *args, timeout=None, chunksize=1, **kwargs):
9797
def parallel(f, items, *args, n_workers=defaults.cpus, total=None, progress=None, pause=0,
9898
threadpool=False, timeout=None, chunksize=1, **kwargs):
9999
"Applies `func` in parallel to `items`, using `n_workers`"
100-
if progress is None: progress = progress_bar is not None
101100
pool = ThreadPoolExecutor if threadpool else ProcessPoolExecutor
102101
with pool(n_workers, pause=pause) as ex:
103102
r = ex.map(f,items, *args, timeout=timeout, chunksize=chunksize, **kwargs)
104-
if progress:
103+
if progress and progress_bar:
105104
if total is None: total = len(items)
106105
r = progress_bar(r, total=total, leave=False)
107106
return L(r)

nbs/03a_parallel.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,10 @@
305305
"def parallel(f, items, *args, n_workers=defaults.cpus, total=None, progress=None, pause=0,\n",
306306
" threadpool=False, timeout=None, chunksize=1, **kwargs):\n",
307307
" \"Applies `func` in parallel to `items`, using `n_workers`\"\n",
308-
" if progress is None: progress = progress_bar is not None\n",
309308
" pool = ThreadPoolExecutor if threadpool else ProcessPoolExecutor\n",
310309
" with pool(n_workers, pause=pause) as ex:\n",
311310
" r = ex.map(f,items, *args, timeout=timeout, chunksize=chunksize, **kwargs)\n",
312-
" if progress:\n",
311+
" if progress and progress_bar:\n",
313312
" if total is None: total = len(items)\n",
314313
" r = progress_bar(r, total=total, leave=False)\n",
315314
" return L(r)"

0 commit comments

Comments
 (0)