summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-04-12 20:28:23 +0200
committerMichał Górny <mgorny@gentoo.org>2018-04-12 21:10:25 +0200
commit1b1202bffb7662b90a752f53e64d5702dc901713 (patch)
tree3764bc59974964bed6aac547e1037f10eb481f00
parentf65b21d0ea45cc2dc79433b426f7e58eef2caaec (diff)
downloadgemato-1b1202bffb7662b90a752f53e64d5702dc901713.tar.gz
Disable multiprocessing to avoid unresolved deadlocks
Remove the use of multiprocessing in order to avoid unresolved deadlocks some of our users are hitting. The wrapper class is preserved, so that multiprocessing can be reintroduced when the issue is resolved.
-rw-r--r--gemato/util.py27
1 files changed, 10 insertions, 17 deletions
diff --git a/gemato/util.py b/gemato/util.py
index eb052b6..94006a6 100644
--- a/gemato/util.py
+++ b/gemato/util.py
@@ -3,44 +3,37 @@
# (c) 2017-2018 Michał Górny
# Licensed under the terms of 2-clause BSD license
-import multiprocessing
-import sys
-
class MultiprocessingPoolWrapper(object):
"""
A portability wrapper for multiprocessing.Pool that supports
context manager API (and any future hacks we might need).
+
+ Note: the multiprocessing behavior has been temporarily removed
+ due to unresolved deadlocks. It will be restored once the cause
+ of the issues is found and fixed or worked around.
"""
- __slots__ = ['pool']
+ __slots__ = []
def __init__(self, processes):
- self.pool = multiprocessing.Pool(processes=processes)
+ pass
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, exc_cb):
- if exc_type is None:
- self.pool.close()
- self.pool.join()
- self.pool.terminate()
+ pass
- def map(self, *args, **kwargs):
- return self.pool.map(*args, **kwargs)
+ def map(self, func, it, chunksize=None):
+ return map(func, it)
def imap_unordered(self, *args, **kwargs):
"""
Use imap_unordered() if available and safe to use. Fall back
to regular map() otherwise.
"""
- if sys.hexversion >= 0x03050400:
- return self.pool.imap_unordered(*args, **kwargs)
- else:
- # in py<3.5.4 imap() swallows exceptions, so fall back
- # to regular map()
- return self.pool.map(*args, **kwargs)
+ return self.map(*args, **kwargs)
def path_starts_with(path, prefix):