From 71f1c2394b98f004f3f1db3358738f8a071a6dae Mon Sep 17 00:00:00 2001 From: "he6@llnl.gov" Date: Thu, 31 Jul 2025 08:36:56 -0700 Subject: [PATCH 1/8] Github CI now skips moe_required marked unit tests --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 6ec0bef5..bbb97c82 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -47,7 +47,7 @@ jobs: - name: pytest run: | # python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/ddm/test/unit - python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/modac/test/unit + python3.9 -m pytest -m "not moe_required" --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/modac/test/unit cd atomsci/ddm/test/unit && python3.9 -m pytest -n 2 --capture=sys --capture=fd --cov=atomsci -vv env: ENV: test From 790aa302a4e3c3693b403bc369edc4eda7410cdd Mon Sep 17 00:00:00 2001 From: "he6@llnl.gov" Date: Thu, 31 Jul 2025 10:58:38 -0700 Subject: [PATCH 2/8] Moved to the atomsci unit test command --- .github/workflows/pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index bbb97c82..234da1eb 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -46,8 +46,8 @@ jobs: - name: pytest run: | - # python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/ddm/test/unit - python3.9 -m pytest -m "not moe_required" --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/modac/test/unit + # python3.9 -m pytest -m "not moe_required" --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/ddm/test/unit + python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/modac/test/unit cd atomsci/ddm/test/unit && python3.9 -m pytest -n 2 --capture=sys --capture=fd --cov=atomsci -vv env: ENV: test From 09d2f88870ec5bbd9e520d26ae6e4e4668388e49 Mon Sep 17 00:00:00 2001 From: "he6@llnl.gov" Date: Thu, 31 Jul 2025 13:24:06 -0700 Subject: [PATCH 3/8] Moved to the atomsci unit test command --- .github/workflows/pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 234da1eb..3738c1cb 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -46,9 +46,9 @@ jobs: - name: pytest run: | - # python3.9 -m pytest -m "not moe_required" --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/ddm/test/unit + # python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/ddm/test/unit python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/modac/test/unit - cd atomsci/ddm/test/unit && python3.9 -m pytest -n 2 --capture=sys --capture=fd --cov=atomsci -vv + cd atomsci/ddm/test/unit && python3.9 -m pytest -m "not moe_required" -n 2 --capture=sys --capture=fd --cov=atomsci -vv env: ENV: test From 0c86f22ce51009e7bfc5780ad5defbbf65720580 Mon Sep 17 00:00:00 2001 From: "he6@llnl.gov" Date: Thu, 31 Jul 2025 15:56:54 -0700 Subject: [PATCH 4/8] Do not run moe_required tests in github CI --- atomsci/ddm/test/integrative/integrative_batch_chunk_tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atomsci/ddm/test/integrative/integrative_batch_chunk_tests b/atomsci/ddm/test/integrative/integrative_batch_chunk_tests index cceb7ba5..cf466ee9 100755 --- a/atomsci/ddm/test/integrative/integrative_batch_chunk_tests +++ b/atomsci/ddm/test/integrative/integrative_batch_chunk_tests @@ -41,7 +41,7 @@ for folder in "${folders[@]}"; do if [[ -f "$file" && "$folder" != "__pycache__/" ]]; then cd "$folder" echo "Testing $folder" - pytest --capture=sys --capture=fd --cov=atomsci -vv + pytest -m "not moe_required" --capture=sys --capture=fd --cov=atomsci -vv cd .. else echo "Skipping folder: $folder. Not a test directory." From fc6405f2f1c5ca229980468bf70f5e08a13a827a Mon Sep 17 00:00:00 2001 From: "he6@llnl.gov" Date: Mon, 4 Aug 2025 11:53:28 -0700 Subject: [PATCH 5/8] set seed for test consistency --- .../ddm/test/integrative/wenzel_NN/config_wenzel_fit_NN.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/atomsci/ddm/test/integrative/wenzel_NN/config_wenzel_fit_NN.json b/atomsci/ddm/test/integrative/wenzel_NN/config_wenzel_fit_NN.json index a1100018..6859fef1 100644 --- a/atomsci/ddm/test/integrative/wenzel_NN/config_wenzel_fit_NN.json +++ b/atomsci/ddm/test/integrative/wenzel_NN/config_wenzel_fit_NN.json @@ -35,6 +35,8 @@ "comment": "Results", "comment": "----------------------------------------", - "result_dir": "result" + "result_dir": "result", + + "seed":0 } From 72869a3535bc309592ad23e06aefa5ef019cca56 Mon Sep 17 00:00:00 2001 From: "he6@llnl.gov" Date: Mon, 4 Aug 2025 16:05:57 -0700 Subject: [PATCH 6/8] pytest in gitlab ci isn't picking up tests in modac/test/unit/ try to cd into the directory --- .github/workflows/pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 3738c1cb..25e2654f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -47,8 +47,8 @@ jobs: - name: pytest run: | # python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/ddm/test/unit - python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/modac/test/unit - cd atomsci/ddm/test/unit && python3.9 -m pytest -m "not moe_required" -n 2 --capture=sys --capture=fd --cov=atomsci -vv + cd atomsci/modac/test/unit && python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv + cd ../../../../atomsci/ddm/test/unit && python3.9 -m pytest -m "not moe_required" -n 2 --capture=sys --capture=fd --cov=atomsci -vv env: ENV: test From de9ac7b3ea0049f892eb0f6e5a1d909a5cba38ec Mon Sep 17 00:00:00 2001 From: "he6@llnl.gov" Date: Tue, 5 Aug 2025 09:57:41 -0700 Subject: [PATCH 7/8] See if commands after pytest batch call get run --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 25e2654f..709cc02c 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -139,8 +139,8 @@ jobs: - name: pytest run: | # TODO: Run this test with pytest for paralell testing - # python3.9 -m pytest -n 2 --capture=sys --capture=fd --cov=atomsci -vv atomsci/ddm/test/integrative cd atomsci/ddm/test/integrative && ./integrative_batch_chunk_tests 1 + echo 'done' env: ENV: test From 8f898cd6f37884d41571988fdf2b6ab7ec8ba7e7 Mon Sep 17 00:00:00 2001 From: "he6@llnl.gov" Date: Tue, 5 Aug 2025 13:52:52 -0700 Subject: [PATCH 8/8] Added simple test to test_hybrid so excluding moe tests won't remove all tests --- atomsci/ddm/pipeline/model_wrapper.py | 3 +-- .../test/integrative/hybrid/test_hybrid.py | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/atomsci/ddm/pipeline/model_wrapper.py b/atomsci/ddm/pipeline/model_wrapper.py index 63b96c7b..59bbda13 100644 --- a/atomsci/ddm/pipeline/model_wrapper.py +++ b/atomsci/ddm/pipeline/model_wrapper.py @@ -1491,7 +1491,6 @@ def train(self, pipeline): em = perf.EpochManager(self, prediction_type="hybrid", model_dataset=pipeline.data, - transformers=self.transformers, is_ki=self.params.is_ki, production=self.params.production, ki_convert_ratio=self.params.ki_convert_ratio) @@ -1532,7 +1531,7 @@ def train(self, pipeline): valid_loss_ep /= (valid_data.n_ki + valid_data.n_bind) train_perf, valid_perf, test_perf = em.update_epoch(ei, - train_dset=train_dset, valid_dset=valid_dset, test_dset=test_dset, fold='final') + train_dset=train_dset, valid_dset=valid_dset, test_dset=test_dset) self.log.info("Epoch %d: training %s = %.3f, training loss = %.3f, validation %s = %.3f, validation loss = %.3f, test %s = %.3f" % ( ei, pipeline.metric_type, train_perf, train_loss_ep, pipeline.metric_type, valid_perf, valid_loss_ep, diff --git a/atomsci/ddm/test/integrative/hybrid/test_hybrid.py b/atomsci/ddm/test/integrative/hybrid/test_hybrid.py index 64cfc271..2aa88ad6 100644 --- a/atomsci/ddm/test/integrative/hybrid/test_hybrid.py +++ b/atomsci/ddm/test/integrative/hybrid/test_hybrid.py @@ -20,6 +20,26 @@ def clean(): if os.path.isfile("./output/"+f): os.remove("./output/"+f) +def test_is_hybrid(): + """Test to see of the model pipeline is built correctly""" + with open("H1_hybrid.json", "r") as f: + hp_params = json.load(f) + + script_dir = parse.__file__.strip("parameter_parser.py").replace("/pipeline/", "") + python_path = sys.executable + hp_params["script_dir"] = script_dir + hp_params["python_path"] = python_path + hp_params["descriptor_type"] = "rdkit_raw" + + params = parse.wrapper(hp_params) + if not os.path.isfile(params.dataset_key): + params.dataset_key = os.path.join(params.script_dir, params.dataset_key) + + print("Train a hybrid models with MOE descriptors") + pl = mp.ModelPipeline(params) + + assert pl.params.model_type == 'hybrid' + @pytest.mark.moe_required def test(): """Test full model pipeline: Curate data, fit model, and predict property for new compounds"""