-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from adrn/dill-multi
Use multiprocess instead of multiprocessing
- Loading branch information
Showing
4 changed files
with
19 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
# type: ignore | ||
import functools | ||
import multiprocessing | ||
import signal | ||
from multiprocessing.pool import Pool | ||
|
||
import multiprocess | ||
from multiprocess.pool import Pool | ||
|
||
__all__ = ["MultiPool"] | ||
|
||
|
@@ -30,10 +31,12 @@ def __call__(self, tasks): | |
|
||
class MultiPool(Pool): | ||
""" | ||
A modified version of :class:`multiprocessing.pool.Pool` that has better | ||
A modified version of :class:`multiprocess.pool.Pool` that has better | ||
behavior with regard to ``KeyboardInterrupts`` in the :func:`map` method. | ||
(Original author: `Peter K. G. Williams <[email protected]>`_) | ||
NOTE: This is no longer built off of the standard library | ||
:class:`multiprocessing.pool.Pool` -- this uses the version from `multiprocess`, | ||
which uses `dill` to pickle objects instead of the standard library `pickle`. | ||
Parameters | ||
---------- | ||
|
@@ -46,8 +49,7 @@ class MultiPool(Pool): | |
Arguments for ``initializer``; it will be called as | ||
``initializer(*initargs)``. | ||
kwargs: | ||
Extra arguments passed to the :class:`multiprocessing.pool.Pool` | ||
superclass. | ||
Extra arguments passed to the :class:`multiprocess.pool.Pool` superclass. | ||
""" | ||
|
||
|
@@ -104,7 +106,7 @@ def map(self, func, iterable, chunksize=None, callback=None): | |
try: | ||
return r.get(self.wait_timeout) | ||
|
||
except multiprocessing.TimeoutError: | ||
except multiprocess.TimeoutError: | ||
pass | ||
|
||
except KeyboardInterrupt: | ||
|