Manage TensorReporter with open file - #135
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #135 +/- ##
==========================================
+ Coverage 70.50% 75.30% +4.79%
==========================================
Files 28 28
Lines 1797 1814 +17
==========================================
+ Hits 1267 1366 +99
+ Misses 530 448 -82 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
e8a38f2 to
de28d69
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The test task configuration and new/updated tests have issues that can reduce CI coverage and reliability, and the checkpoint fallback should also handle OS-level file errors to meet the intended robustness.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adjusts the OpenMM equilibration/production runners to keep the TensorReporter output file handle open for the duration of the simulation step(s), avoiding reporter writes to a closed file. It also tightens some type hints and refreshes sample-density test fixtures/data used by compute tests.
Changes:
- Run equilibration/production stepping inside the
with open(..., "wb")block that backsTensorReporter. - Add checkpoint-load fallbacks and minor refactors in equilibration/production setup.
- Update/extend sample-density test fixtures and add basic compute tests for equilibration/production.
File summaries
| File | Description |
|---|---|
pixi.toml |
Updates the test task command and sets OpenMM platform env for test runs. |
dimsim/compute/apps.py |
Narrows type hint for minimization_future passed into equilibration app. |
dimsim/compute/_produce.py |
Keeps TensorReporter file open during production stepping; adds checkpoint-load fallback logic. |
dimsim/compute/_equilibrate.py |
Keeps TensorReporter file open during equilibration stepping; adds checkpoint-load fallback logic and typing cleanup. |
dimsim/_tests/data/app_files/sample_density/target_config.json |
Refreshes sample-density fixture ID. |
dimsim/_tests/data/app_files/sample_density/production.csv |
Updates expected production CSV fixture output. |
dimsim/_tests/data/app_files/sample_density/packed_topology.pdb |
Refreshes packed topology fixture header timestamp. |
dimsim/_tests/data/app_files/sample_density/minimized_topology.pdb |
Refreshes minimized topology fixture header timestamp. |
dimsim/_tests/data/app_files/sample_density/equilibrated_topology.pdb |
Adds new equilibrated topology fixture for tests. |
dimsim/_tests/data/app_files/make_sample_density_files.py |
Updates sample-data generation script indexing and density analysis invocation. |
dimsim/_tests/compute/test_produce.py |
Adds a production smoke test using sample-density fixtures. |
dimsim/_tests/compute/test_equilibration.py |
Adds an equilibration smoke test using sample-density fixtures. |
Review details
- Files reviewed: 11/17 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| def test_basic(tmp_path, minimization_future): | ||
| for file in ["compute_config.json", "packed_topology.pdb", "openmm_system.xml"]: | ||
| shutil.copy( | ||
| str(files("dimsim") / f"_tests/data/app_files/sample_density/{file}"), | ||
| str(tmp_path / file), | ||
| ) | ||
| pass | ||
|
|
||
| _run_equilibration( | ||
| equilibration_config=None, # Replace with an actual EquilibrationConfig object | ||
| minimization_future=minimization_future, | ||
| job_dir=str(tmp_path), | ||
| ) |
| def test_basic(tmp_path, equilibration_future): | ||
| for file in ["compute_config.json", "packed_topology.pdb", "openmm_system.xml"]: | ||
| shutil.copy( | ||
| str(files("dimsim") / f"_tests/data/app_files/sample_density/{file}"), | ||
| str(tmp_path / file), | ||
| ) | ||
| pass | ||
|
|
||
| _run_production( | ||
| production_config=None, # Replace with an actual ProductionConfig object | ||
| equilibration_future=equilibration_future, | ||
| job_dir=str(tmp_path), | ||
| ) |
| try: | ||
| simulation.loadCheckpoint(minimized_files["checkpoint"].filepath) | ||
| except openmm.OpenMMException as error: | ||
| # loading checkpoint isn't so necessary when starting a new simulation since we are |
| try: | ||
| simulation.loadCheckpoint(equilibrated_files["checkpoint"].filepath) | ||
| except openmm.OpenMMException as error: | ||
| # loading checkpoint isn't so necessary when starting a new simulation since we are |
| run_tests = { | ||
| cmd = "python -m pytest --lf --durations=10 --cov=dimsim --cov-config=pyproject.toml --cov-append --cov-report=xml --color=yes dimsim/_tests", | ||
| env = {OPENMM_DEFAULT_PLATFORM="CPU"} | ||
| } |
No description provided.