From 7e5e547d342d1dcdb61cde7e9d593385c5baec6a Mon Sep 17 00:00:00 2001 From: Andrew Audibert Date: Fri, 10 Jan 2025 08:38:59 -0800 Subject: [PATCH] #grain Fix issue with running over 50 subprocesses. PiperOrigin-RevId: 714064248 --- grain/_src/python/shared_memory_array.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/grain/_src/python/shared_memory_array.py b/grain/_src/python/shared_memory_array.py index b4584d0a..3ffc982f 100644 --- a/grain/_src/python/shared_memory_array.py +++ b/grain/_src/python/shared_memory_array.py @@ -135,10 +135,7 @@ def enable_async_del( """ with SharedMemoryArray._lock: if not SharedMemoryArray._del_thread_pool: - if max_outstanding_requests < num_threads: - raise ValueError( - "max_outstanding_requests must be at least num_threads." - ) + max_outstanding_requests = max(max_outstanding_requests, num_threads) SharedMemoryArray._del_thread_pool = pool.ThreadPool(num_threads) SharedMemoryArray._outstanding_del_requests = threading.Semaphore( max_outstanding_requests