Skip to content

Commit 7a6e60e

Browse files
Fix
1 parent 8a38750 commit 7a6e60e

File tree

2 files changed

+3
-20
lines changed

2 files changed

+3
-20
lines changed

src/clusterfuzz/_internal/base/concurrency.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,16 @@
2121
POOL_SIZE = multiprocessing.cpu_count()
2222

2323

24-
class SingleThreadPool:
25-
"""Single thread pool for when it's not worth using Python's thread
26-
implementation."""
27-
28-
def __init__(self, size):
29-
del size
30-
31-
def map(self, f, l):
32-
return list(map(f, l))
33-
34-
def imap_unordered(self, f, l):
35-
return list(map(f, l))
36-
37-
3824
@contextlib.contextmanager
39-
def make_pool(pool_size=POOL_SIZE, cpu_bound=False, max_pool_size=None):
25+
def make_pool(pool_size=POOL_SIZE, max_pool_size=None):
4026
"""Returns a pool that can (usually) execute tasks concurrently."""
4127
if max_pool_size is not None:
4228
pool_size = min(pool_size, max_pool_size)
4329

4430
# Don't use processes on Windows and unittests to avoid hangs.
4531
if (environment.get_value('PY_UNITTESTS') or
4632
environment.platform() == 'WINDOWS'):
47-
if cpu_bound:
48-
yield SingleThreadPool(pool_size)
49-
else:
50-
yield futures.ThreadPoolExecutor(pool_size)
33+
yield futures.ThreadPoolExecutor(pool_size)
5134
else:
5235
yield futures.ProcessPoolExecutor(pool_size)
5336

src/clusterfuzz/_internal/google_cloud_utils/storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ def parallel_map(func, argument_list):
13831383
will OOM."""
13841384
max_size = 2
13851385
timeout = 120
1386-
with concurrency.make_pool(cpu_bound=True, max_pool_size=max_size) as pool:
1386+
with concurrency.make_pool(max_pool_size=max_size) as pool:
13871387
calls = {pool.submit(func, argument) for argument in argument_list}
13881388
while calls:
13891389
finished_calls, _ = futures.wait(

0 commit comments

Comments
 (0)