From c8aa2b2f64744a83482fcd9e25fc80740a528218 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Wed, 17 Apr 2024 10:45:11 +0200 Subject: [PATCH] Mount absolute path of working dir to local runner (#931) As part of the new interface and manifest changes this bug appeared. We are not able to run the new fondant version in jupyter notebooks cause the working directory isn't resolved correctly. Mounting the complete path instead of the stem solves the issue. --- src/fondant/dataset/compiler.py | 8 ++++---- tests/pipeline/test_compiler.py | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/fondant/dataset/compiler.py b/src/fondant/dataset/compiler.py index fce63514..1d6964b8 100644 --- a/src/fondant/dataset/compiler.py +++ b/src/fondant/dataset/compiler.py @@ -180,10 +180,10 @@ def resolve_local_base_path(base_path: Path) -> Path: volume = DockerVolume( type="bind", source=str(p_base_path), - target=f"/{p_base_path.stem}", + target=str(p_base_path), ) - path = f"/{p_base_path.stem}" - return path, volume + + return str(p_base_path), volume def _generate_spec( self, @@ -246,7 +246,7 @@ def _generate_spec( command.extend( [ "--working_directory", - working_directory, + path, ], ) diff --git a/tests/pipeline/test_compiler.py b/tests/pipeline/test_compiler.py index 2052ae7e..bcf85e47 100644 --- a/tests/pipeline/test_compiler.py +++ b/tests/pipeline/test_compiler.py @@ -213,7 +213,6 @@ def test_docker_local_path(setup_pipeline, tmp_path_factory): with tmp_path_factory.mktemp("temp") as fn: # this is the directory mounted in the container _, _, dataset, cache_dict = setup_pipeline - work_dir_stem = f"/{fn.stem}" working_directory = str(fn) compiler = DockerCompiler() output_path = str(fn / "docker-compose.yml") @@ -234,14 +233,14 @@ def test_docker_local_path(setup_pipeline, tmp_path_factory): assert component_configs.volumes == [ { "source": str(fn), - "target": work_dir_stem, + "target": str(fn), "type": "bind", }, ] cleaned_pipeline_name = dataset.name.replace("_", "") # check if commands are patched to use the working dir expected_output_manifest_path = ( - f"{work_dir_stem}/{cleaned_pipeline_name}/{expected_run_id}" + f"{str(fn)}/{cleaned_pipeline_name}/{expected_run_id}" f"/{component_name}/manifest.json" )