-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[PYTHON][RPC] Make rpc proxy jupyter friendly via PopenWorker. #7757
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to run tests/python/contrib/test_rpc_proxy.py
with this PR on my Mac, but its failing. The error is
INFO:root:RPCProxy: client port bind to localhost:9092
INFO:root:RPCProxy: Websock port bind to 8888
Traceback (most recent call last):
File "tests/python/contrib/test_rpc_proxy.py", line 75, in <module>
rpc_proxy_check()
File "tests/python/contrib/test_rpc_proxy.py", line 68, in rpc_proxy_check
check()
File "tests/python/contrib/test_rpc_proxy.py", line 62, in check
client = rpc.connect(prox.host, prox.port, key="x1")
File "/Users/tristan/octoml/tvm/python/tvm/rpc/client.py", line 501, in connect
sess = _ffi_api.Connect(url, port, key, *session_constructor_args)
File "/Users/tristan/octoml/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
[bt] (7) 8 ??? 0x00007ffeee90cf00 0x0 + 140732900888320
[bt] (6) 7 _ctypes.cpython-38-darwin.so 0x000000010199f177 ffi_call_unix64 + 79
[bt] (5) 6 libtvm.dylib 0x0000000127bd9526 TVMFuncCall + 70
[bt] (4) 5 libtvm.dylib 0x0000000127c4ebfb std::__1::__function::__func<tvm::runtime::$_0, std::__1::allocator<tvm::runtime::$_0>, void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)>::operator()(tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&) + 315
[bt] (3) 4 libtvm.dylib 0x0000000127c4dd73 tvm::runtime::RPCClientConnect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, tvm::runtime::TVMArgs) + 99
[bt] (2) 3 libtvm.dylib 0x0000000127c4c00a tvm::runtime::RPCConnect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, tvm::runtime::TVMArgs) + 570
[bt] (1) 2 libtvm.dylib 0x0000000126aba42c tvm::runtime::detail::LogFatal::~LogFatal() + 92
[bt] (0) 1 libtvm.dylib 0x0000000127bec748 tvm::runtime::Backtrace() + 24
File "/Users/tristan/octoml/tvm/src/runtime/rpc/rpc_socket_impl.cc", line 73
TVMError: ---------------------------------------------------------------
An internal invariant was violated during the execution of TVM.
Please read TVM's error reporting guidelines.
More details can be found here: https://discuss.tvm.ai/t/error-reporting/7793.
---------------------------------------------------------------
Check failed: sock.Connect(addr) == false: Connect to ::1:9092 failed
INFO:root:Terminating Proxy Server...
Is this expected?
self.port = my_port | ||
break | ||
except socket.error as sock_err: | ||
if sock_err.errno in [98, 48]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these the same on windows? @rkimball
Thanks @tkonolige The particular error seems to also be the legacy issue of previous code of IPv6 and IPv4 mix. i have updated the test so it now works |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I tested it on my Mac with python 3.9.
CC @zxybazh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…e#7757) * [PYTHON][RPC] Make rpc proxy jupyter friendly via PopenWorker. * Rework the contrib tests that was previous broken.
…e#7757) * [PYTHON][RPC] Make rpc proxy jupyter friendly via PopenWorker. * Rework the contrib tests that was previous broken.
…e#7757) * [PYTHON][RPC] Make rpc proxy jupyter friendly via PopenWorker. * Rework the contrib tests that was previous broken.
…e#7757) * [PYTHON][RPC] Make rpc proxy jupyter friendly via PopenWorker. * Rework the contrib tests that was previous broken.
Previously the proxy relies multiprocessing to start a new process and does not work under jupyter. In the case of proxy however, we still need the tornado to help handle the web assembly wehpage hosting, so still need python in this particular case.
This PR switches that to use PopenWorker instead of multiprocessing.Process. We will send a worker function that: