Skip to content

Manage TensorReporter with open file - #135

Draft
mattwthompson wants to merge 12 commits into
mainfrom
fix-smee-reporter
Draft

Manage TensorReporter with open file#135
mattwthompson wants to merge 12 commits into
mainfrom
fix-smee-reporter

Conversation

@mattwthompson

Copy link
Copy Markdown
Member

No description provided.

@codecov-commenter

codecov-commenter commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.30%. Comparing base (10824fa) to head (f7daaaf).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 backs TensorReporter.
  • 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.

Comment on lines +23 to +35
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),
)
Comment on lines +27 to +39
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),
)
Comment on lines +75 to +78
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
Comment on lines +71 to +74
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
Comment thread pixi.toml
Comment on lines +8 to +11
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"}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants