Skip to content

Commit

Permalink
use concurrent.futures
Browse files Browse the repository at this point in the history
  • Loading branch information
sadikneipp committed Nov 28, 2024
1 parent f4dd5db commit 7edd76f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pathwaysutils/persistence/pathways_orbax_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
"""TypeHandlers supporting Pathways backend."""

from multiprocessing import Pool
import concurrent.futures
import collections
import concurrent.futures
import datetime
Expand Down Expand Up @@ -175,8 +175,13 @@ async def deserialize(
grouped_shardings,
)
]
with Pool() as p:
grouped_arrays_and_futures = p.starmap(f, args_list)
with concurrent.futures.ThreadPoolExecutor() as e:
side_channel_call_futures = [e.submit(f, *args) for args in args_list]
concurrent.futures.wait(
side_channel_call_futures,
return_when=concurrent.futures.ALL_COMPLETED,
)
grouped_arrays_and_futures = [side_channel_call_future.result() for side_channel_call_future in side_channel_call_futures]
# grouped_arrays_and_futures = [
# f(
# location=location,
Expand Down

0 comments on commit 7edd76f

Please sign in to comment.