From c44a86b0fb8a09ef82bab4aa4273a75e137f97a1 Mon Sep 17 00:00:00 2001 From: Maciej Wielgosz <maciej.wielgosz@nibio.no> Date: Fri, 7 Jul 2023 15:52:07 +0200 Subject: [PATCH] update for /home/datasciencefolder mapping in the oracle cloud --- Dockerfile | 9 ++++++--- check_list.info | 8 +++++++- d_run.sh | 5 +++-- helpers/clean_oracle_log_from_timestemp.py | 23 ++++++++++++++++++++++ run_oracle_wrapper_local.py | 8 ++++++-- 5 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 helpers/clean_oracle_log_from_timestemp.py diff --git a/Dockerfile b/Dockerfile index a3b9d19..a4a661e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,14 +37,17 @@ RUN pip install parse oci ocifs COPY requirements.txt app/requirements.txt RUN pip install --no-cache -r app/requirements.txt -COPY . /app +# COPY . /app +# WORKDIR /app -WORKDIR /app +COPY . /home/datascience/app +WORKDIR /home/datascience/app # ENTRYPOINT ["/miniconda/bin/conda", "run", "-n", "pdal-env", "python", "/app/run_oracle_wrapper.py"] -ENTRYPOINT ["/miniconda/bin/conda", "run", "-n", "pdal-env", "python", "/app/run_oracle_wrapper_local.py"] +# ENTRYPOINT ["/miniconda/bin/conda", "run", "-n", "pdal-env", "python", "/app/run_oracle_wrapper_local.py"] +ENTRYPOINT ["/miniconda/bin/conda", "run", "-n", "pdal-env", "python", "/home/datascience/app/run_oracle_wrapper_local.py"] diff --git a/check_list.info b/check_list.info index a2df05e..a5ae4cc 100644 --- a/check_list.info +++ b/check_list.info @@ -1,4 +1,10 @@ Dockerfile - set correct oracle wrapper + +# core steps build.sh run_oracle_wrapper.py or run_oracle_wrapper_local.py -> pick a right mode (DEBUG or not) -config.yaml -> pick segmentation or instance segmentation \ No newline at end of file +config.yaml -> pick segmentation or instance segmentation + +# pushing docker +docker tag nibio/pc-geoslam-oracle-inst-seg:latest fra.ocir.io/axqlz2potslu/nibio/pc-geoslam-oracle-inst-seg +docker push fra.ocir.io/axqlz2potslu/nibio/pc-geoslam-oracle-sem-seg \ No newline at end of file diff --git a/d_run.sh b/d_run.sh index 0897181..1199955 100644 --- a/d_run.sh +++ b/d_run.sh @@ -6,8 +6,9 @@ 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_oracle,target=/app/local_folder_oracle \ - nibio/pc-geoslam-oracle + --mount type=bind,source=/home/nibio/mutable-outside-world/code/oracle_deploy/instance_segmentation_classic/local_folder_oracle,target=/home/datascience/app/local_folder_oracle \ + --mount type=bind,source=/home/nibio/mutable-outside-world/code/oracle_deploy/instance_segmentation_classic/local_folder_oracle_hard,target=/home/datascience/app/local_folder_oracle_hard \ + nibio/pc-geoslam-oracle > test_oracle.log 2>&1 diff --git a/helpers/clean_oracle_log_from_timestemp.py b/helpers/clean_oracle_log_from_timestemp.py new file mode 100644 index 0000000..9610601 --- /dev/null +++ b/helpers/clean_oracle_log_from_timestemp.py @@ -0,0 +1,23 @@ +import sys + +def remove_prefix(lines): + processed_lines = [line.split(' - ', 1)[1] if ' - ' in line else line for line in lines] + return processed_lines + +def process_file(input_filename, output_filename): + with open(input_filename, 'r') as input_file: + data = input_file.read() + lines = data.split('\n') + processed_lines = remove_prefix(lines) + processed_data = '\n'.join(processed_lines) + with open(output_filename, 'w') as output_file: + output_file.write(processed_data) + +if __name__ == '__main__': + if len(sys.argv) < 3: + print("Please provide both input and output filenames as command-line arguments.") + else: + input_filename = sys.argv[1] + output_filename = sys.argv[2] + process_file(input_filename, output_filename) + print(f"Processed data saved to {output_filename}.") diff --git a/run_oracle_wrapper_local.py b/run_oracle_wrapper_local.py index 83f9049..f23d69b 100644 --- a/run_oracle_wrapper_local.py +++ b/run_oracle_wrapper_local.py @@ -20,8 +20,12 @@ def run_oracle_wrapper(path_to_config_file): # read system environment variables if DEBUG_MODE: - input_location = "local_folder_oracle/las_files/" - output_location = "local_folder_oracle/results/" + input_location = "local_folder_oracle_hard/las_files/" + output_location = "local_folder_oracle_hard/results/" + + # 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) -- GitLab