From 48e3b042a4d4bd900d2dd8246c5649092c512084 Mon Sep 17 00:00:00 2001 From: Maciej Wielgosz <maciej.wielgosz@nibio.no> Date: Thu, 29 Jun 2023 10:23:48 +0200 Subject: [PATCH] fix for creating output folder in the oracle if does not exist --- d_run.sh | 2 +- run_oracle_wrapper_local.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/d_run.sh b/d_run.sh index e7ee426..0897181 100644 --- a/d_run.sh +++ b/d_run.sh @@ -6,7 +6,7 @@ echo "Running the container" # docker run --gpus all --name test_oracle nibio/pc-geoslam-oracle docker run -it --gpus all \ --name test_oracle \ - --mount type=bind,source=/home/nibio/mutable-outside-world/code/oracle_deploy/instance_segmentation_classic/local_folder_out/las_files,target=/app/local_folder_out/las_files \ + --mount type=bind,source=/home/nibio/mutable-outside-world/code/oracle_deploy/instance_segmentation_classic/local_folder_oracle,target=/app/local_folder_oracle \ nibio/pc-geoslam-oracle diff --git a/run_oracle_wrapper_local.py b/run_oracle_wrapper_local.py index 47083ac..83f9049 100644 --- a/run_oracle_wrapper_local.py +++ b/run_oracle_wrapper_local.py @@ -20,10 +20,11 @@ def run_oracle_wrapper(path_to_config_file): # read system environment variables if DEBUG_MODE: - input_location = "local_folder_in/las_files/" - output_location = "local_folder_out/las_files/" - # remove content of the output folder - shutil.rmtree(output_location, ignore_errors=True) + input_location = "local_folder_oracle/las_files/" + output_location = "local_folder_oracle/results/" + # remove content of the output folder if it exists + if os.path.exists(output_location): + shutil.rmtree(output_location, ignore_errors=True) else: # get the input and output locations from the environment variables input_location = os.environ['OBJ_INPUT_LOCATION'] @@ -33,6 +34,9 @@ def run_oracle_wrapper(path_to_config_file): input_location = input_location.replace("@axqlz2potslu", "").replace("oci://", "/mnt/") output_location = output_location.replace("@axqlz2potslu", "").replace("oci://", "/mnt/") + # create the output folder if it does not exist + os.makedirs(output_location, exist_ok=True) + # copy files from input_location to the input folder shutil.copytree(input_location, config_flow_params['general']['input_folder']) -- GitLab