Skip to content

Commit

Permalink
replaced threadpool with processpool
Browse files Browse the repository at this point in the history
  • Loading branch information
star-nox committed Dec 11, 2023
1 parent 05bc59e commit 9e6d9ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ai_ta_backend/filtering_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def run_context_filtering(contexts, user_query, max_time_before_return=45, max_c
partial_func1 = partial(filter_context, user_query=user_query, langsmith_prompt_obj=langsmith_prompt_obj)
partial_func2 = partial(select_context, result=filtered_contexts)

with ThreadPoolExecutor(max_workers=200) as executor1:
with ProcessPoolExecutor(max_workers=200) as executor1:
results1 = list(executor1.map(partial_func1, contexts))

print(f"⏰ ThreadPool runtime: {(time.monotonic() - start_time):.2f} seconds")
Expand Down

0 comments on commit 9e6d9ae

Please sign in to comment.