Commit ab9146be authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[execution][docker] Added support for custom port from range

parent 5e596c3f
......@@ -216,7 +216,14 @@ class DockerExecutor(RemoteExecutor):
def _kill():
self.host.kill(algorithm_container)
self.message_handler = message_handler.MessageHandler(self.host.ip,
address = self.host.ip
port_range = self.data.pop('port_range', None)
if port_range:
min_port, max_port = port_range.split(':')
port = utils.find_free_port_in_range(int(min_port), int(max_port))
address += ':{}'.format(port)
self.message_handler = message_handler.MessageHandler(address,
kill_callback=_kill)
......
......@@ -70,6 +70,13 @@ class TestDockerExecution(BaseExecutionMixIn):
assert result is None
@slow
def test_custom_port_range(self):
result = self.execute('user/user/integers_addition/1/integers_addition',
[{'sum': 495, 'nb': 9}], port_range="50000:50100")
assert result is None
# NOT COMPATIBLE YET WITH THE NEW API
# @slow
# def test_cxx_double_1(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment