|
294 | 294 | { |
295 | 295 | "data": { |
296 | 296 | "text/plain": [ |
297 | | - "<__main__._t at 0x7fd7b4badb90>" |
| 297 | + "<__main__._t at 0x7fd2eaf8cf50>" |
298 | 298 | ] |
299 | 299 | }, |
300 | 300 | "execution_count": null, |
|
1625 | 1625 | { |
1626 | 1626 | "data": { |
1627 | 1627 | "text/plain": [ |
1628 | | - "['a', 'e', 'b', 'h', 'c', 'd', 'g', 'f']" |
| 1628 | + "['g', 'e', 'f', 'a', 'h', 'c', 'd', 'b']" |
1629 | 1629 | ] |
1630 | 1630 | }, |
1631 | 1631 | "execution_count": null, |
|
3511 | 3511 | "#export\n", |
3512 | 3512 | "class ProcessPoolExecutor(concurrent.futures.ProcessPoolExecutor):\n", |
3513 | 3513 | " \"Same as Python's ProcessPoolExecutor, except can pass `max_workers==0` for serial execution\"\n", |
3514 | | - " def __init__(self, max_workers=defaults.cpus, on_exc=print, pause=0,\n", |
3515 | | - " mp_context=None, initializer=None, initargs=(),):\n", |
| 3514 | + " def __init__(self, max_workers=defaults.cpus, on_exc=print, pause=0, **kwargs):\n", |
3516 | 3515 | " if max_workers is None: max_workers=defaults.cpus\n", |
3517 | 3516 | " store_attr()\n", |
3518 | 3517 | " self.not_parallel = max_workers==0\n", |
3519 | 3518 | " if self.not_parallel: max_workers=1\n", |
3520 | | - " super().__init__(max_workers, mp_context=mp_context, initializer=initializer, initargs=initargs)\n", |
| 3519 | + " super().__init__(max_workers, **kwargs)\n", |
3521 | 3520 | "\n", |
3522 | 3521 | " def map(self, f, items, timeout=None, chunksize=1, *args, **kwargs):\n", |
3523 | 3522 | " self.lock = Manager().Lock()\n", |
|
3538 | 3537 | "text/markdown": [ |
3539 | 3538 | "<h4 id=\"ProcessPoolExecutor\" class=\"doc_header\"><code>class</code> <code>ProcessPoolExecutor</code><a href=\"\" class=\"source_link\" style=\"float:right\">[source]</a></h4>\n", |
3540 | 3539 | "\n", |
3541 | | - "> <code>ProcessPoolExecutor</code>(**`max_workers`**=*`64`*, **`on_exc`**=*`print`*, **`pause`**=*`0`*, **`mp_context`**=*`None`*, **`initializer`**=*`None`*, **`initargs`**=*`()`*) :: [`ProcessPoolExecutor`](/utils.html#ProcessPoolExecutor)\n", |
| 3540 | + "> <code>ProcessPoolExecutor</code>(**`max_workers`**=*`64`*, **`on_exc`**=*`print`*, **`pause`**=*`0`*, **\\*\\*`kwargs`**) :: [`ProcessPoolExecutor`](/utils.html#ProcessPoolExecutor)\n", |
3542 | 3541 | "\n", |
3543 | 3542 | "Same as Python's ProcessPoolExecutor, except can pass `max_workers==0` for serial execution" |
3544 | 3543 | ], |
|
3554 | 3553 | "show_doc(ProcessPoolExecutor, title_level=4)" |
3555 | 3554 | ] |
3556 | 3555 | }, |
| 3556 | + { |
| 3557 | + "cell_type": "markdown", |
| 3558 | + "metadata": {}, |
| 3559 | + "source": [ |
| 3560 | + "`kwargs` are passed to Python's [`concurrent.futures.ProcessPoolExecutor`](https://python.readthedocs.io/en/latest/library/concurrent.futures.html#processpoolexecutor), so depend on your python version. From Python 3.7, they are: `mp_context=None`, `initializer=None`, `initargs=()`." |
| 3561 | + ] |
| 3562 | + }, |
3557 | 3563 | { |
3558 | 3564 | "cell_type": "code", |
3559 | 3565 | "execution_count": null, |
|
0 commit comments