-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update HTEX.Interchange to listen on a single interface (#2828)
This PR updates the HTEX.Interchange to listen for connections from the managers only on a specific interface rather than the current default of binding to all interfaces. Binding to all interfaces is generally frowned upon on login nodes, when all we need is to allow connections from the internal network. Here are the changes: Pass HighThroughputExecutor.address to Interchange.interchange_address Interchange will bind only to the interchange_address if it is specified instead of the binding to zmq:* or 0.0.0.0 which is the current default. Adding tests for the Interchange Please note that configs which specify HTEX(address="localhost") or similar where a non IPv4 address will now fail
- Loading branch information
Showing
4 changed files
with
66 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import logging | ||
|
||
import psutil | ||
import pytest | ||
import zmq | ||
|
||
from parsl.executors.high_throughput.interchange import Interchange | ||
|
||
|
||
def test_interchange_binding_no_address(): | ||
ix = Interchange() | ||
assert ix.interchange_address == "*" | ||
|
||
|
||
def test_interchange_binding_with_address(): | ||
# Using loopback address | ||
address = "127.0.0.1" | ||
ix = Interchange(interchange_address=address) | ||
assert ix.interchange_address == address | ||
|
||
|
||
def test_interchange_binding_with_non_ipv4_address(): | ||
# Confirm that a ipv4 address is required | ||
address = "localhost" | ||
with pytest.raises(zmq.error.ZMQError): | ||
Interchange(interchange_address=address) | ||
|
||
|
||
def test_interchange_binding_bad_address(): | ||
""" Confirm that we raise a ZMQError when a bad address is supplied""" | ||
address = "550.0.0.0" | ||
with pytest.raises(zmq.error.ZMQError): | ||
Interchange(interchange_address=address) | ||
|
||
|
||
def test_limited_interface_binding(): | ||
""" When address is specified the worker_port would be bound to it rather than to 0.0.0.0""" | ||
address = "127.0.0.1" | ||
ix = Interchange(interchange_address=address) | ||
ix.worker_result_port | ||
proc = psutil.Process() | ||
conns = proc.connections(kind="tcp") | ||
|
||
matched_conns = [conn for conn in conns if conn.laddr.port == ix.worker_result_port] | ||
assert len(matched_conns) == 1 | ||
assert matched_conns[0].laddr.ip == address |