Commit 9161d67b authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[execution][docker] Refactor handling of database container

Explicitly set the name of the container and retrieve its
address with the new Host API.
parent d2605333
......@@ -279,9 +279,11 @@ class DockerExecutor(RemoteExecutor):
if logger.getEffectiveLevel() <= logging.DEBUG:
cmd.insert(1, '--debug')
databases_container_name = "beat_db_%s" % utils.id_generator()
databases_container = self.host.create_container(databases_environment, cmd)
databases_container.uid = datasets_uid
databases_container.network_name = network_name
databases_container.set_name(databases_container_name)
# Specify the volumes to mount inside the container
databases_container.add_volume(databases_configuration_path, '/beat/prefix')
......@@ -308,13 +310,7 @@ class DockerExecutor(RemoteExecutor):
cmd = [x if not x.startswith('0.0.0.0:') else '0.0.0.0:%d' % database_port for x in cmd]
databases_container.command = cmd
database_ip = self.host.ip
client = docker.from_env()
for container in client.containers.list():
newtwork_settings = container.attrs['NetworkSettings']
for port, mapping in newtwork_settings['Ports'].items():
if port.startswith('%d' % database_port):
database_ip = newtwork_settings['Networks'][network_name]['IPAddress']
database_ip = self.host.get_ipaddress(databases_container)
#----- Instantiate the algorithm container
......
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