Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/ml multiprocessing bug #804

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions multtest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import multiprocessing


def worker(a):
print(a)


if __name__ == "__main__":
a = []
multiprocessing.set_start_method("spawn")
p = multiprocessing.Process(target=worker, args=("hello",))
p.start()
a.append(p)
p.join()
5 changes: 4 additions & 1 deletion robyn/processpool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import webbrowser
from multiprocess import Process
import multiprocess as mp
import signal
import sys
from typing import Dict, List
Expand Down Expand Up @@ -77,6 +78,8 @@ def init_processpool(
response_headers: Headers,
) -> List[Process]:
process_pool = []
ctx = mp.get_context("fork")

if sys.platform.startswith("win32"):
spawn_process(
directories,
Expand All @@ -95,7 +98,7 @@ def init_processpool(

for _ in range(processes):
copied_socket = socket.try_clone()
process = Process(
process = ctx.Process(
target=spawn_process,
args=(
directories,
Expand Down
Loading