-
-
Notifications
You must be signed in to change notification settings - Fork 768
Unix socket support #9337
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
base: main
Are you sure you want to change the base?
Unix socket support #9337
Changes from all commits
723ad80
791466a
455252d
819c378
14b6670
5bb2eea
ebdd90d
de2a7ec
959bd1f
5c8451b
bd52b6e
34f1ba2
0db0f6a
805dc71
c2ce79b
66fb708
d875699
e5fc50d
d2e191a
42a2561
0bf2f6e
a5431bc
558101d
04a14d6
588d58f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,7 @@ | |
| get_tcp_server_address, | ||
| to_frames, | ||
| ) | ||
| from distributed.compatibility import WINDOWS | ||
| from distributed.protocol.utils import host_array, pack_frames_prelude, unpack_frames | ||
| from distributed.system import MEMORY_LIMIT | ||
| from distributed.utils import ensure_ip, ensure_memoryview, get_ip, nbytes | ||
|
|
@@ -59,7 +60,7 @@ def set_tcp_timeout(comm): | |
| """ | ||
| Set kernel-level TCP timeout on the stream. | ||
| """ | ||
| if comm.closed(): | ||
| if comm.closed() or (not WINDOWS and comm.socket.family is socket.AF_UNIX): | ||
| return | ||
|
|
||
| timeout = dask.config.get("distributed.comm.timeouts.tcp") | ||
|
|
@@ -124,7 +125,10 @@ def get_stream_address(comm): | |
| if comm.closed(): | ||
| raise CommClosedError() | ||
|
|
||
| return unparse_host_port(*comm.socket.getsockname()[:2]) | ||
| if not WINDOWS and comm.socket.family is socket.AF_UNIX: | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like that we have to check for unix socket stuff in Refactoring this is slightly more involved than for To work around this, we would have to implement An example of this approach is again here: dometto@5e60065 Let me know if you'd like me to implement that.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Basically dometto@5e60065 removes all subclassing from To make the |
||
| return comm.socket.getsockname() or comm.socket.getpeername() | ||
| else: | ||
| return unparse_host_port(*comm.socket.getsockname()[:2]) | ||
|
|
||
|
|
||
| def convert_stream_closed_error(obj, exc): | ||
|
|
@@ -567,6 +571,7 @@ async def connect(self, address, deserialize=True, **connection_args): | |
| raise FatalCommClosedError() from err | ||
|
|
||
| local_address = self.prefix + get_stream_address(stream) | ||
|
|
||
| comm = self.comm_class( | ||
| stream, local_address, self.prefix + address, deserialize | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import pytest | ||
|
|
||
| from distributed.compatibility import WINDOWS | ||
|
|
||
| from distributed.comm.addressing import parse_address, unparse_address | ||
| from distributed.comm.registry import backends, get_backend | ||
| from distributed.comm.uds import UDSBackend | ||
|
|
||
|
|
||
| @pytest.mark.skipif(WINDOWS, reason="No unix sockets on Windows") | ||
| def test_registered(): | ||
| assert "unix" in backends | ||
| backend = get_backend("unix") | ||
| assert isinstance(backend, UDSBackend) | ||
|
|
||
|
|
||
| @pytest.mark.skipif(WINDOWS, reason="No unix sockets on Windows") | ||
| def test_parse_uds_address(): | ||
| addr = "unix:///tmp/dask-test.sock" | ||
| scheme, loc = parse_address(addr) | ||
| assert scheme == "unix" | ||
| assert loc == "/tmp/dask-test.sock" | ||
| assert unparse_address(scheme, loc) == addr |
Uh oh!
There was an error while loading. Please reload this page.
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 don't like that we have to check for unix socket stuff in
tcp.py-- that should all belong to the subclass.To refactor this we could change
set_tcp_timeoutto a function in theTCPclass, create a newUDSsubclass ofTCPinuds.py, and overrideset_tcp_timeoutthere.An example of moving
set_tcp_timeoutto theTCPclass is here: dometto@5e60065Let me know if you'd like me to implement that.