Commit e7011275 authored by Samuel GAIST's avatar Samuel GAIST

[execution][docker] Move prefix and cache path to constants

parent eedd5b6b
......@@ -146,6 +146,9 @@ class DockerExecutor(RemoteExecutor):
"""
CONTAINER_PREFIX_PATH = "/beat/prefix"
CONTAINER_CACHE_PATH = "/beat/cache"
def __init__(
self,
host,
......@@ -218,8 +221,8 @@ class DockerExecutor(RemoteExecutor):
cmd = [
"databases_provider",
"0.0.0.0:%d" % database_port,
"/beat/prefix",
"/beat/cache",
self.CONTAINER_PREFIX_PATH,
self.CONTAINER_CACHE_PATH,
]
if configuration_name:
......@@ -235,8 +238,10 @@ class DockerExecutor(RemoteExecutor):
databases_info.set_name(databases_info_name)
# Specify the volumes to mount inside the container
databases_info.add_volume(databases_configuration_path, "/beat/prefix")
databases_info.add_volume(self.cache, "/beat/cache")
databases_info.add_volume(
databases_configuration_path, self.CONTAINER_PREFIX_PATH
)
databases_info.add_volume(self.cache, self.CONTAINER_CACHE_PATH)
for db_name, db_path in database_paths.items():
databases_info.add_volume(db_path, os.path.join("/databases", db_name))
......@@ -384,8 +389,8 @@ class DockerExecutor(RemoteExecutor):
cmd = [
"loop_execute",
"0.0.0.0:{}".format(loop_algorithm_container_port),
"/beat/prefix",
"/beat/cache",
self.CONTAINER_PREFIX_PATH,
self.CONTAINER_CACHE_PATH,
]
if len(self.databases) > 0:
......@@ -406,9 +411,11 @@ class DockerExecutor(RemoteExecutor):
loop_algorithm_container.network_name = network_name
# Volumes
loop_algorithm_container.add_volume(configuration_path, "/beat/prefix")
loop_algorithm_container.add_volume(
self.cache, "/beat/cache", read_only=False
configuration_path, self.CONTAINER_PREFIX_PATH
)
loop_algorithm_container.add_volume(
self.cache, self.CONTAINER_CACHE_PATH, read_only=False
)
# Start the container
......@@ -424,9 +431,9 @@ class DockerExecutor(RemoteExecutor):
# Command to execute
cmd = [
"execute",
"--cache=/beat/cache",
"--cache={}".format(self.CONTAINER_CACHE_PATH),
self.message_handler.address,
"/beat/prefix",
self.CONTAINER_PREFIX_PATH,
]
if len(self.databases) > 0:
......@@ -450,8 +457,10 @@ class DockerExecutor(RemoteExecutor):
algorithm_container.network_name = network_name
# Volumes
algorithm_container.add_volume(configuration_path, "/beat/prefix")
algorithm_container.add_volume(self.cache, "/beat/cache", read_only=False)
algorithm_container.add_volume(configuration_path, self.CONTAINER_PREFIX_PATH)
algorithm_container.add_volume(
self.cache, self.CONTAINER_CACHE_PATH, read_only=False
)
# Start the container
self.host.start(
......
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