From a7a7608b72ea60e18e7437bc4a5bea7335b78623 Mon Sep 17 00:00:00 2001 From: Robin van Westrenen Date: Wed, 8 Apr 2026 17:07:46 +0200 Subject: [PATCH] Prevent _work directory mixing in testbench and HPC pipelines In test_set_runner.py, preserve existing _work directory when --skip-run is set, so the receive pipeline does not overwrite remote execution results with pristine input. If _work does not exist yet, create it normally regardless of skip-run. In common_utilities.sh, filter find_dimr_directories to skip non-_work directories when a _work sibling exists, preventing duplicate model execution on H7. --- .../linux/scripts/hpc-smoke/common_utilities.sh | 10 +++++++++- test/deltares_testbench/src/suite/test_set_runner.py | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ci/teamcity/Delft3D/linux/scripts/hpc-smoke/common_utilities.sh b/ci/teamcity/Delft3D/linux/scripts/hpc-smoke/common_utilities.sh index cb2e667d5bd..081bb82e7a3 100755 --- a/ci/teamcity/Delft3D/linux/scripts/hpc-smoke/common_utilities.sh +++ b/ci/teamcity/Delft3D/linux/scripts/hpc-smoke/common_utilities.sh @@ -4,7 +4,15 @@ # This file contains shared functions used by prepare_all_models.sh and run_all_models.sh find_dimr_directories() { - find . -type f \( -name "dimr.xml" -o -name "dimr_config.xml" \) -exec dirname {} \; | sort -u + find . -type f \( -name "dimr.xml" -o -name "dimr_config.xml" \) -exec dirname {} \; | sort -u | while read dir; do + dir_name=$(basename "$dir") + parent_dir=$(dirname "$dir") + # Skip non-_work directory when a _work sibling exists (prefer _work for execution) + if [[ "$dir_name" != *_work ]] && [ -d "$parent_dir/${dir_name}_work" ]; then + continue + fi + echo "$dir" + done } is_supported_platform() { diff --git a/test/deltares_testbench/src/suite/test_set_runner.py b/test/deltares_testbench/src/suite/test_set_runner.py index fa67df59ccf..1d95cd80b3c 100644 --- a/test/deltares_testbench/src/suite/test_set_runner.py +++ b/test/deltares_testbench/src/suite/test_set_runner.py @@ -609,7 +609,11 @@ def __process_test_case_locations(self, config: TestCaseConfig, logger: ILogger) local_path = self.__build_local_path(config, location) self.__download_location_with_retries(config, location, remote_path, local_path, logger) if location.type == PathType.INPUT: - self.__copy_to_work_folder(Path(local_path), logger) + work_path = Path(local_path).with_name(f"{Path(local_path).name}_work") + if work_path.exists() and self.settings.command_line_settings.skip_run: + logger.debug(f"Preserving existing work directory: {work_path}") + else: + self.__copy_to_work_folder(Path(local_path), logger) self.__set_absolute_paths(config, location.type, local_path)