Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
0fce0907
Unverified
Commit
0fce0907
authored
Apr 09, 2021
by
Tonny-Gu
Committed by
GitHub
Apr 08, 2021
Browse files
[Distributed] Bind to the correct NIC (#2798)
Co-authored-by:
Da Zheng
<
zhengda1936@gmail.com
>
parent
bfbbefa7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
python/dgl/distributed/rpc_client.py
python/dgl/distributed/rpc_client.py
+4
-4
No files found.
python/dgl/distributed/rpc_client.py
View file @
0fce0907
...
@@ -71,7 +71,7 @@ def get_local_machine_id(server_namebook):
...
@@ -71,7 +71,7 @@ def get_local_machine_id(server_namebook):
break
break
return
res
return
res
def
get_local_usable_addr
():
def
get_local_usable_addr
(
probe_addr
):
"""Get local usable IP and port
"""Get local usable IP and port
Returns
Returns
...
@@ -81,8 +81,8 @@ def get_local_usable_addr():
...
@@ -81,8 +81,8 @@ def get_local_usable_addr():
"""
"""
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
try
:
try
:
#
doesn't even have to be reachable
#
should get the address on the same subnet as probe_addr's
sock
.
connect
((
'10.255.255.255'
,
1
))
sock
.
connect
((
probe_addr
,
1
))
ip_addr
=
sock
.
getsockname
()[
0
]
ip_addr
=
sock
.
getsockname
()[
0
]
except
ValueError
:
except
ValueError
:
ip_addr
=
'127.0.0.1'
ip_addr
=
'127.0.0.1'
...
@@ -159,7 +159,7 @@ def connect_to_server(ip_config, num_servers, max_queue_size=MAX_QUEUE_SIZE, net
...
@@ -159,7 +159,7 @@ def connect_to_server(ip_config, num_servers, max_queue_size=MAX_QUEUE_SIZE, net
rpc
.
add_receiver_addr
(
server_ip
,
server_port
,
server_id
)
rpc
.
add_receiver_addr
(
server_ip
,
server_port
,
server_id
)
rpc
.
sender_connect
()
rpc
.
sender_connect
()
# Get local usable IP address and port
# Get local usable IP address and port
ip_addr
=
get_local_usable_addr
()
ip_addr
=
get_local_usable_addr
(
server_ip
)
client_ip
,
client_port
=
ip_addr
.
split
(
':'
)
client_ip
,
client_port
=
ip_addr
.
split
(
':'
)
# Register client on server
# Register client on server
register_req
=
rpc
.
ClientRegisterRequest
(
ip_addr
)
register_req
=
rpc
.
ClientRegisterRequest
(
ip_addr
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment