Commit 6e28d902 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[execution][docker] Implement database root folder sharing

A new property in the execution configuration allows to
mount the various databases in the algorithm container
in a similar fashion as the database container. It will
only work for containers that needs to access datasets.

Fixes #103
parent b9960cee
......@@ -384,6 +384,15 @@ class DockerExecutor(RemoteExecutor):
file_path = result["path"]
def __share_databases(self, algorithm_container, db_infos):
"""Add volumes to the algorithm container for the datasets"""
for database_name, database in self.databases.items():
db_data =
db_data["root_folder"], os.path.join("/databases", database_name)
def process(
self, virtual_memory_in_megabytes=0, max_cpu_percent=0, timeout_in_minutes=0
......@@ -472,6 +481,8 @@ class DockerExecutor(RemoteExecutor):
network_name ="network_name", "bridge")
databases_infos = {}
share_databases ="share_databases", False)
if len(self.databases) > 0:
databases_infos["db"] = self.__create_db_container(
datasets_uid, network_name
......@@ -526,6 +537,9 @@ class DockerExecutor(RemoteExecutor):
loop_algorithm_container, volume_cache_mount_point,["loop"]
if share_databases:
self.__share_databases(loop_algorithm_container, databases_infos)
# Start the container
......@@ -570,6 +584,9 @@ class DockerExecutor(RemoteExecutor):
algorithm_container, volume_cache_mount_point,
if share_databases:
self.__share_databases(algorithm_container, databases_infos)
# Start the container
Supports Markdown
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