Skip to content

Orca MM Runner#224

Open
MattBurn wants to merge 14 commits into
faccts:mainfrom
MattBurn:orca-mm
Open

Orca MM Runner#224
MattBurn wants to merge 14 commits into
faccts:mainfrom
MattBurn:orca-mm

Conversation

@MattBurn

@MattBurn MattBurn commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Closes Issues

Closes #185

Description

Extracts shared ORCA execution logic from Runner into a new BaseRunner and adds OrcaMmRunner in opi.execution.mm for running orca_mm.

OrcaMmRunner adds typed helpers for supported orca_mm subcommands, validates expected output files, and raises a dedicated OrcaMmException when orca_mm reports errors on stderr. This also extends OrcaBinary with ORCA_MM and adds unit coverage for stderr handling, including the empty/deleted temporary stderr-file case.


Release Notes

Added

  • Added BaseRunner to share ORCA binary resolution, environment setup, version checks, and subprocess execution across runner implementations. (Orca MM Runner #224)
  • Added OrcaMmRunner with helpers for orca_mm commands such as convff, splitff, mergeff, repeatff, splitpdb, mergepdb, makeff, and getHDist. (Orca MM Runner #224)
  • Added OrcaBinary.ORCA_MM and unit tests covering orca_mm stderr handling. (Orca MM Runner #224)

Changed

  • Changed Runner to inherit from BaseRunner, keeping orca, orca_plot, and orca_2json behavior while moving shared execution logic into the base class. (Orca MM Runner #224)

@MattBurn MattBurn requested a review from a team as a code owner March 31, 2026 09:34
@timmyte timmyte self-requested a review April 1, 2026 09:14

@timmyte timmyte 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.

@MattBurn
Thanks a lot for the PR. Thanks a very nice addition and improvement for OPI. Also thanks to directly include proper tests.

I would appreciate if you could overall add more comments and documentation to the code. Most patterns are very repetitive, so they would only a single documentation somewhere prominently on module level.

Comment thread src/opi/execution/base.py Outdated
Comment thread src/opi/execution/orca_mm.py Outdated
Comment thread src/opi/execution/mm.py Outdated
Comment thread src/opi/execution/orca_mm.py
Comment thread src/opi/execution/base.py Outdated
"""
expected_output = structure_file.with_suffix(self._orca_ff_suffix)

arguments = [str(structure_file)]

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.

Please add some more comments to this routine, to point out the individual steps and preparations done here, like,

  1. generating files
  2. assembling call
  3. performing call

@@ -0,0 +1,50 @@
from pathlib import Path

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.

Please add a module level description what is tested in this module and also list the individual tests.

from opi.execution.mm import OrcaMmException, OrcaMmRunner


def _set_fake_orca_path(self, orca_path: Path | None = None) -> None:

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.

Please add docstrings.
Mention why these fake are necessary as this is not trivial.


@pytest.mark.unit
def test_run_orca_mm_handles_deleted_empty_stderr(monkeypatch: pytest.MonkeyPatch):
monkeypatch.setattr(OrcaMmRunner, "set_orca_path", _set_fake_orca_path)

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.

Didn't know Pytest has MonkeyPatch. Very sophisticated. Thanks!!


runner = OrcaMmRunner()

def fake_run(binary, args, /, *, stderr=None, silent=True, timeout=-1):

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.

Again, please add docstring. Why fake execution. Please describe your design. Could also do this on module level, as the pattern is the same.

Comment thread src/opi/execution/orca_mm.py
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.

Running Orca MM

3 participants