From 35c3ab3a6d3696ddf3a460909ec0ab79cfe3864a Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 13 Feb 2026 16:20:57 +0100 Subject: [PATCH 1/7] Test with FluxClusterExecutor --- .github/workflows/amorphouspy_api.yml | 2 +- amorphouspy_api/src/amorphouspy_api/worker.py | 4 ++-- environment.yml | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/amorphouspy_api.yml b/.github/workflows/amorphouspy_api.yml index ab87b17e..44793498 100644 --- a/.github/workflows/amorphouspy_api.yml +++ b/.github/workflows/amorphouspy_api.yml @@ -36,7 +36,7 @@ jobs: shell: bash -l {0} working-directory: amorphouspy_api run: | - amorphouspy_INTEGRATION=1 uvicorn amorphouspy_api.app:app --port 8002 & + flux start amorphouspy_INTEGRATION=1 uvicorn amorphouspy_api.app:app --port 8002 & pytest -m integration -s --durations=0 --cov=src/amorphouspy_api --cov-report=xml --cov-report=term --cov-append - name: Pytest coverage comment diff --git a/amorphouspy_api/src/amorphouspy_api/worker.py b/amorphouspy_api/src/amorphouspy_api/worker.py index aeddb898..0abfa2dc 100644 --- a/amorphouspy_api/src/amorphouspy_api/worker.py +++ b/amorphouspy_api/src/amorphouspy_api/worker.py @@ -65,7 +65,7 @@ def meltquench_worker(task_id: str, request_dict: dict[str, Any], db_path: str, melt_quench_simulation, ) from amorphouspy.workflows.structural_analysis import analyze_structure - from executorlib.api import TestClusterExecutor + from executorlib import FluxClusterExecutor # Create composition string from request comp_parts = [] @@ -88,7 +88,7 @@ def meltquench_worker(task_id: str, request_dict: dict[str, Any], db_path: str, logger.info(f"Task {task_id}: Using shared project directory: {project_path}") # Create executor for caching workflow results - with TestClusterExecutor(cache_directory=project_path) as exe: + with FluxClusterExecutor(cache_directory=project_path) as exe: atoms_dict = exe.submit( get_structure_dict, composition=composition, diff --git a/environment.yml b/environment.yml index ed75f161..93f30b33 100644 --- a/environment.yml +++ b/environment.yml @@ -21,3 +21,4 @@ dependencies: - uvicorn - fastapi-mcp =0.4.0 - sovapy =0.8.3 +- flux-core =0.81.0 \ No newline at end of file From 2ff8401ecc0ac245426e2003525e8ab1128e1c80 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 13 Feb 2026 16:27:42 +0100 Subject: [PATCH 2/7] write test to file --- .github/workflows/amorphouspy_api.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/amorphouspy_api.yml b/.github/workflows/amorphouspy_api.yml index 44793498..ef37354f 100644 --- a/.github/workflows/amorphouspy_api.yml +++ b/.github/workflows/amorphouspy_api.yml @@ -36,8 +36,9 @@ jobs: shell: bash -l {0} working-directory: amorphouspy_api run: | - flux start amorphouspy_INTEGRATION=1 uvicorn amorphouspy_api.app:app --port 8002 & - pytest -m integration -s --durations=0 --cov=src/amorphouspy_api --cov-report=xml --cov-report=term --cov-append + echo "amorphouspy_INTEGRATION=1 uvicorn amorphouspy_api.app:app --port 8002 & pytest -m integration -s --durations=0 --cov=src/amorphouspy_api --cov-report=xml --cov-report=term --cov-append" > test.sh + chmod +x test.sh + flux start ./test.sh - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main From c20331f4bca913c2dcb0a366cc26693441441856 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 13 Feb 2026 16:39:59 +0100 Subject: [PATCH 3/7] add pysqa --- environment.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 93f30b33..d598c5e9 100644 --- a/environment.yml +++ b/environment.yml @@ -21,4 +21,5 @@ dependencies: - uvicorn - fastapi-mcp =0.4.0 - sovapy =0.8.3 -- flux-core =0.81.0 \ No newline at end of file +- flux-core =0.81.0 +- pysqa =0.3.4 \ No newline at end of file From 99117f1ec9454b2208a1b908803b698f8eb6eba5 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 13 Feb 2026 17:41:56 +0100 Subject: [PATCH 4/7] Use dependencies --- amorphouspy_api/src/amorphouspy_api/worker.py | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/amorphouspy_api/src/amorphouspy_api/worker.py b/amorphouspy_api/src/amorphouspy_api/worker.py index 0abfa2dc..7195f34f 100644 --- a/amorphouspy_api/src/amorphouspy_api/worker.py +++ b/amorphouspy_api/src/amorphouspy_api/worker.py @@ -65,7 +65,7 @@ def meltquench_worker(task_id: str, request_dict: dict[str, Any], db_path: str, melt_quench_simulation, ) from amorphouspy.workflows.structural_analysis import analyze_structure - from executorlib import FluxClusterExecutor + from executorlib import FluxClusterExecutor, get_item_from_future # Create composition string from request comp_parts = [] @@ -89,23 +89,23 @@ def meltquench_worker(task_id: str, request_dict: dict[str, Any], db_path: str, # Create executor for caching workflow results with FluxClusterExecutor(cache_directory=project_path) as exe: - atoms_dict = exe.submit( + atoms_dict_future = exe.submit( get_structure_dict, composition=composition, # n_molecules=5000, # Default number of molecules target_atoms=request.n_atoms, - ).result() - logger.info(f"Task {task_id}: Structure dictionary created with {len(atoms_dict['atoms'])} atoms") + ) + # logger.info(f"Task {task_id}: Structure dictionary created with {len(atoms_dict['atoms'])} atoms") structure_future = exe.submit( get_ase_structure, - atoms_dict=atoms_dict, + atoms_dict=atoms_dict_future, ) logger.info(f"Task {task_id}: ASE structure created") potential_future = exe.submit( generate_potential, - atoms_dict=atoms_dict, + atoms_dict=atoms_dict_future, potential_type=request.potential_type, ) logger.info(f"Task {task_id}: Potential generated") @@ -123,7 +123,7 @@ def meltquench_worker(task_id: str, request_dict: dict[str, Any], db_path: str, # Run meltquench simulation logger.info(f"Task {task_id}: Executing simulation workflow") - result = exe.submit( + result_future = exe.submit( melt_quench_simulation, structure=structure_future, potential=potential_future, @@ -133,7 +133,7 @@ def meltquench_worker(task_id: str, request_dict: dict[str, Any], db_path: str, cooling_rate=request.cooling_rate, langevin=False, server_kwargs={}, - ).result() + ) logger.info(f"Task {task_id}: Simulation completed successfully") # Update task status for structural analysis @@ -143,15 +143,17 @@ def meltquench_worker(task_id: str, request_dict: dict[str, Any], db_path: str, logger.info(f"Task {task_id}: Starting structural analysis") # Perform structural analysis on the final structure (includes density calculation) - final_structure = result["structure"] - logger.info(f"Task {task_id}: Analyzing structure with {len(final_structure)} atoms") + # final_structure = result["structure"] + # logger.info(f"Task {task_id}: Analyzing structure with {len(final_structure)} atoms") # Run structural analysis - structural_data = exe.submit( + structural_data_future = exe.submit( analyze_structure, - atoms=final_structure, - ).result() + atoms=get_item_from_future(result_future, "structure") + ) logger.info(f"Task {task_id}: Structural analysis completed successfully") + structural_data = structural_data_future.result() + result = result_future.result() # Debug: Check what fields are present in the structural_data object logger.info(f"Task {task_id}: StructureData type: {type(structural_data)}") From a6c36154f7186dd97ef54eed3c40c1ab47ee2cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Jan=C3=9Fen?= Date: Fri, 13 Feb 2026 18:20:27 +0100 Subject: [PATCH 5/7] ruff fix --- amorphouspy_api/src/amorphouspy_api/worker.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/amorphouspy_api/src/amorphouspy_api/worker.py b/amorphouspy_api/src/amorphouspy_api/worker.py index 7195f34f..9d2aa4b3 100644 --- a/amorphouspy_api/src/amorphouspy_api/worker.py +++ b/amorphouspy_api/src/amorphouspy_api/worker.py @@ -148,8 +148,7 @@ def meltquench_worker(task_id: str, request_dict: dict[str, Any], db_path: str, # Run structural analysis structural_data_future = exe.submit( - analyze_structure, - atoms=get_item_from_future(result_future, "structure") + analyze_structure, atoms=get_item_from_future(result_future, "structure") ) logger.info(f"Task {task_id}: Structural analysis completed successfully") structural_data = structural_data_future.result() From 543447c5c69511bd248707a6038f823d4cc3374f Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 13 Feb 2026 22:54:13 +0100 Subject: [PATCH 6/7] Update executorlib version to 1.8.1 --- environment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index d598c5e9..a1e505af 100644 --- a/environment.yml +++ b/environment.yml @@ -5,7 +5,7 @@ dependencies: - python =3.13 - ase >=3.25.0 - cryptography =45.0.7 -- executorlib =1.7.4 +- executorlib =1.8.1 - hatchling - jupyter - lammps =2024.08.29=*_openmpi_* @@ -22,4 +22,4 @@ dependencies: - fastapi-mcp =0.4.0 - sovapy =0.8.3 - flux-core =0.81.0 -- pysqa =0.3.4 \ No newline at end of file +- pysqa =0.3.4 From 7e4a0302c2408a585c4344eeb9622e1d24fd7810 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 13 Feb 2026 22:55:51 +0100 Subject: [PATCH 7/7] Update executorlib version to 1.8.1 --- environment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index d598c5e9..a1e505af 100644 --- a/environment.yml +++ b/environment.yml @@ -5,7 +5,7 @@ dependencies: - python =3.13 - ase >=3.25.0 - cryptography =45.0.7 -- executorlib =1.7.4 +- executorlib =1.8.1 - hatchling - jupyter - lammps =2024.08.29=*_openmpi_* @@ -22,4 +22,4 @@ dependencies: - fastapi-mcp =0.4.0 - sovapy =0.8.3 - flux-core =0.81.0 -- pysqa =0.3.4 \ No newline at end of file +- pysqa =0.3.4