-
-
Notifications
You must be signed in to change notification settings - Fork 778
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
Unix socket support #9337
Changes from all commits
5a12b7a
38cd096
a3c1d15
1d1a07b
dc71438
d8ba6e9
c4a70d2
4c553b6
897a11f
ff91328
3947fb8
b08af6e
0258bca
2727e30
4d56d34
54ab14b
4dfece5
b39a7e2
3492356
19604ef
e48dfee
022adb0
e28d6be
196184f
f0445ee
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.