diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 289e4c7..b32edba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,3 +19,10 @@ jobs: - name: run system tests run: | ./scripts/test_system.sh + - name: upload optimizer output ESDLs + if: always() + uses: actions/upload-artifact@v4 + with: + name: optimizer-output-esdls-py${{ matrix.python-version }} + path: system_tests_artifacts/ + if-no-files-found: warn diff --git a/.gitignore b/.gitignore index 264d1a1..6b1373b 100644 --- a/.gitignore +++ b/.gitignore @@ -219,4 +219,5 @@ fabric.properties unit_test_coverage/ .env.test -gurobi/ \ No newline at end of file +gurobi/ +system_tests_artifacts/ \ No newline at end of file diff --git a/system_tests/docker-compose.override.yml b/system_tests/docker-compose.override.yml index ba603c6..1713df5 100644 --- a/system_tests/docker-compose.override.yml +++ b/system_tests/docker-compose.override.yml @@ -3,6 +3,8 @@ services: build: system_tests/ # This is referenced from root of repo due to how docker-compose works. networks: - omotes + volumes: + - ./system_tests_artifacts:/app/test_esdl/artifacts depends_on: rabbitmq: condition: service_healthy diff --git a/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path.esdl b/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path.esdl index 6d28f9f..5868b1b 100644 --- a/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path.esdl +++ b/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path.esdl @@ -1,5 +1,5 @@ - + @@ -11,14 +11,16 @@ - + - + + - + + @@ -40,39 +42,41 @@ - + - - + + - - + + - - + + - + + - + + - + + - - + @@ -100,16 +104,18 @@ - + + - + + - + + - @@ -137,16 +143,18 @@ - + + - + + - + + - @@ -178,16 +186,18 @@ - + + - + + - + + - @@ -214,16 +224,18 @@ - + + - + + - + + - @@ -242,7 +254,7 @@ - + @@ -250,26 +262,28 @@ - + + - + + - + + - - - + + - - + + - - + + @@ -280,16 +294,18 @@ - + + - + + - + + - @@ -300,16 +316,18 @@ - + + - + + - + + - @@ -319,16 +337,18 @@ - + + - + + - + + - @@ -338,16 +358,18 @@ - + + - + + - + + - @@ -359,11 +381,13 @@ - + + - + + @@ -387,7 +411,7 @@ - + @@ -420,11 +444,13 @@ - + + - + + @@ -446,7 +472,7 @@ - + @@ -479,11 +505,13 @@ - + + - + + @@ -503,7 +531,7 @@ - + @@ -527,63 +555,63 @@ - + - - + + - - + + - - - + + + - - - + + + - - + + - + - + - + diff --git a/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_1source.esdl b/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_1source.esdl index 52c43bc..73aa539 100644 --- a/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_1source.esdl +++ b/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_1source.esdl @@ -1,5 +1,5 @@ - + @@ -11,14 +11,16 @@ - + - + + - + + @@ -48,16 +50,18 @@ - + + - + + - + + - @@ -89,16 +93,18 @@ - + + - + + - + + - @@ -126,16 +132,18 @@ - + + - + + - + + - @@ -167,16 +175,18 @@ - + + - + + - + + - @@ -203,16 +213,18 @@ - + + - + + - + + - @@ -250,16 +262,18 @@ - + + - + + - + + - @@ -269,16 +283,18 @@ - + + - + + - + + - @@ -289,16 +305,18 @@ - + + - + + - + + - @@ -308,16 +326,18 @@ - + + - + + - + + - @@ -327,16 +347,18 @@ - + + - + + - + + - @@ -348,11 +370,13 @@ - + + - + + @@ -376,7 +400,7 @@ - + @@ -409,11 +433,13 @@ - + + - + + @@ -435,7 +461,7 @@ - + @@ -468,11 +494,13 @@ - + + - + + @@ -492,7 +520,7 @@ - + @@ -516,18 +544,18 @@ - + - - + + - + @@ -535,24 +563,24 @@ - - - + + + - - - + + + - + @@ -560,19 +588,19 @@ - + - + - + diff --git a/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_2ndsource.esdl b/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_2ndsource.esdl index 3538451..2db3289 100644 --- a/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_2ndsource.esdl +++ b/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_2ndsource.esdl @@ -1,5 +1,5 @@ - + @@ -11,14 +11,16 @@ - + - + + - + + @@ -40,39 +42,41 @@ - + - - + + - - + + - - + + - + + - + + - + + - - + @@ -100,16 +104,18 @@ - + + - + + - + + - @@ -137,16 +143,18 @@ - + + - + + - + + - @@ -178,16 +186,18 @@ - + + - + + - + + - @@ -214,16 +224,18 @@ - + + - + + - + + - @@ -242,7 +254,7 @@ - + @@ -250,26 +262,28 @@ - + + - + + - + + - - - + + - - + + - - + + @@ -280,16 +294,18 @@ - + + - + + - + + - @@ -300,16 +316,18 @@ - + + - + + - + + - @@ -319,16 +337,18 @@ - + + - + + - + + - @@ -338,16 +358,18 @@ - + + - + + - + + - @@ -359,11 +381,13 @@ - + + - + + @@ -387,7 +411,7 @@ - + @@ -420,11 +444,13 @@ - + + - + + @@ -446,7 +472,7 @@ - + @@ -479,11 +505,13 @@ - + + - + + @@ -503,7 +531,7 @@ - + @@ -527,63 +555,63 @@ - + - - + + - - + + - - - + + + - - - + + + - - + + - + - + - + diff --git a/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_2ndsource_merit_order_swapped.esdl b/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_2ndsource_merit_order_swapped.esdl index a2b791b..d0c9bc9 100644 --- a/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_2ndsource_merit_order_swapped.esdl +++ b/system_tests/src/test_esdl/output/test__grow_optimizer_default__happy_path_2ndsource_merit_order_swapped.esdl @@ -1,5 +1,5 @@ - + @@ -11,14 +11,16 @@ - + - + + - + + @@ -40,39 +42,41 @@ - + - - + + - - + + - - + + - + + - + + - + + - - + @@ -100,16 +104,18 @@ - + + - + + - + + - @@ -137,16 +143,18 @@ - + + - + + - + + - @@ -178,16 +186,18 @@ - + + - + + - + + - @@ -214,16 +224,18 @@ - + + - + + - + + - @@ -242,7 +254,7 @@ - + @@ -250,26 +262,28 @@ - + + - + + - + + - - - + + - - + + - - + + @@ -280,16 +294,18 @@ - + + - + + - + + - @@ -300,16 +316,18 @@ - + + - + + - + + - @@ -319,16 +337,18 @@ - + + - + + - + + - @@ -338,16 +358,18 @@ - + + - + + - + + - @@ -359,11 +381,13 @@ - + + - + + @@ -387,7 +411,7 @@ - + @@ -420,11 +444,13 @@ - + + - + + @@ -446,7 +472,7 @@ - + @@ -479,11 +505,13 @@ - + + - + + @@ -503,7 +531,7 @@ - + @@ -527,63 +555,63 @@ - + - - + + - - + + - - - + + + - - - + + + - - + + - + - + - + diff --git a/system_tests/src/test_esdl/output/test__grow_optimizer_no_heat_losses__happy_path.esdl b/system_tests/src/test_esdl/output/test__grow_optimizer_no_heat_losses__happy_path.esdl index 019e12c..9a8f3f9 100644 --- a/system_tests/src/test_esdl/output/test__grow_optimizer_no_heat_losses__happy_path.esdl +++ b/system_tests/src/test_esdl/output/test__grow_optimizer_no_heat_losses__happy_path.esdl @@ -1,5 +1,5 @@ - + @@ -11,14 +11,16 @@ - + - + + - + + @@ -40,39 +42,41 @@ - + - - + + - - + + - - + + - + + - + + - + + - - + @@ -100,16 +104,18 @@ - + + - + + - + + - @@ -137,16 +143,18 @@ - + + - + + - + + - @@ -178,16 +186,18 @@ - + + - + + - + + - @@ -214,16 +224,18 @@ - + + - + + - + + - @@ -242,7 +254,7 @@ - + @@ -250,26 +262,28 @@ - + + - + + - + + - - - + + - - + + - - + + @@ -280,16 +294,18 @@ - + + - + + - + + - @@ -300,16 +316,18 @@ - + + - + + - + + - @@ -319,16 +337,18 @@ - + + - + + - + + - @@ -338,16 +358,18 @@ - + + - + + - + + - @@ -359,11 +381,13 @@ - + + - + + @@ -387,7 +411,7 @@ - + @@ -420,11 +444,13 @@ - + + - + + @@ -446,7 +472,7 @@ - + @@ -479,11 +505,13 @@ - + + - + + @@ -503,7 +531,7 @@ - + @@ -527,63 +555,63 @@ - + - - + + - - + + - - - + + + - - - + + + - - + + - + - + - + diff --git a/system_tests/src/test_workflows_steps.py b/system_tests/src/test_workflows_steps.py index 935b296..c598037 100644 --- a/system_tests/src/test_workflows_steps.py +++ b/system_tests/src/test_workflows_steps.py @@ -62,6 +62,18 @@ ESDL_VALUES_PRECISION = 1e-6 +ARTIFACTS_DIR = Path(os.environ.get("OPTIMIZER_ARTIFACTS_DIR", "/app/test_esdl/artifacts")) + + +def save_optimizer_output(test_name: str, output_esdl: str) -> None: + """Write the optimizer output ESDL to the artifacts directory for CI upload.""" + try: + ARTIFACTS_DIR.mkdir(parents=True, exist_ok=True) + (ARTIFACTS_DIR / f"{test_name}.esdl").write_text(output_esdl, encoding="utf-8") + except OSError as exc: + print(f"[{test_name}] WARNING: could not save artifact: {exc}", flush=True) + + class OmotesJobHandler: progress_updates: list[JobProgressUpdate] status_updates: list[JobStatusUpdate] @@ -266,6 +278,8 @@ def test__grow_optimizer_default__happy_path(self) -> None: # Assert self.expect_a_result(result_handler, JobResult.SUCCEEDED) + if result_handler.result.output_esdl: + save_optimizer_output("test__grow_optimizer_default__happy_path", result_handler.result.output_esdl) expected_esdl = retrieve_esdl_file( "./test_esdl/output/test__grow_optimizer_default__happy_path.esdl" ) @@ -288,6 +302,8 @@ def test__grow_optimizer_no_heat_losses__happy_path(self) -> None: # Assert self.expect_a_result(result_handler, JobResult.SUCCEEDED) + if result_handler.result.output_esdl: + save_optimizer_output("test__grow_optimizer_no_heat_losses__happy_path", result_handler.result.output_esdl) expected_esdl = retrieve_esdl_file( "./test_esdl/output/test__grow_optimizer_no_heat_losses__happy_path.esdl" ) @@ -390,6 +406,8 @@ def test__grow_optimizer_default__happy_path_1source(self) -> None: # Assert self.expect_a_result(result_handler, JobResult.SUCCEEDED) + if result_handler.result.output_esdl: + save_optimizer_output("test__grow_optimizer_default__happy_path_1source", result_handler.result.output_esdl) expected_esdl = retrieve_esdl_file( "./test_esdl/output/test__grow_optimizer_default__happy_path_1source.esdl" ) @@ -414,6 +432,8 @@ def test__grow_optimizer_default__happy_path_2ndsource(self) -> None: # Assert self.expect_a_result(result_handler, JobResult.SUCCEEDED) + if result_handler.result.output_esdl: + save_optimizer_output("test__grow_optimizer_default__happy_path_2ndsource", result_handler.result.output_esdl) expected_esdl = retrieve_esdl_file( "./test_esdl/output/test__grow_optimizer_default__happy_path_2ndsource.esdl" ) @@ -440,6 +460,8 @@ def test__grow_optimizer_default__happy_path_2ndsource_merit_order_swapped( # Assert self.expect_a_result(result_handler, JobResult.SUCCEEDED) + if result_handler.result.output_esdl: + save_optimizer_output("test__grow_optimizer_default__happy_path_2ndsource_merit_order_swapped", result_handler.result.output_esdl) expected_esdl = retrieve_esdl_file( "./test_esdl/output/test__grow_optimizer_default__happy_path_2ndsource_merit_order_swapped.esdl" ) @@ -683,7 +705,7 @@ def wait_for_all_jobs(timeout_seconds: float) -> None: def _watch_job(result_handler: OmotesJobHandler): result_handler.wait_until_result(timeout_seconds) with result_ids_lock: - ordered_job_result_ids.append(result_handler.result.uuid) + ordered_job_result_ids.append(str(result_handler.result.uuid)) with condition: condition.notify_all()