Skip to content

Conversation

@jan-janssen
Copy link
Member

@jan-janssen jan-janssen commented Sep 24, 2025

Summary by CodeRabbit

  • New Features

    • Added an optional hostname_localhost parameter to MPI-related initializers for configurable localhost handling while preserving defaults.
  • Tests

    • Updated tests to exercise the new hostname_localhost option and skipped two macOS-specific tests; adjusted two numeric assertions to compare rounded values.
  • Chores

    • CI expanded with new macOS jobs to run MPICH and OpenMPI tests, increasing platform coverage.
@coderabbitai
Copy link

coderabbitai bot commented Sep 24, 2025

Warning

Rate limit exceeded

@jan-janssen has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 36 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7912b79 and 1299f7d.

📒 Files selected for processing (1)
  • tests/test_ase_interface.py (2 hunks)

Walkthrough

Adds an optional hostname_localhost parameter across wrapper constructors (ASE, concurrent, extended) and forwards it into executor/LammpsBase initialization; updates tests to pass the new flag and adjust one ASE test to skip on Darwin. Also adds two macOS GitHub Actions jobs to run MPICH and OpenMPI MPI tests.

Changes

Cohort / File(s) Summary
CI: macOS MPI jobs
\.github/workflows/pipeline\.yml
Adds unittest_mpich_mac and unittest_openmpi_mac jobs mirroring existing Linux MPI test flows (checkout, conda/miniconda setup with .condarc, environment YAMLs, pip install, unittest discovery with 5m timeout).
Wrappers: parameter propagation
pylammpsmpi/wrapper/ase.py, pylammpsmpi/wrapper/concurrent.py, pylammpsmpi/wrapper/extended.py
Add hostname_localhost: Optional[bool] = None to constructors and propagate it into underlying initialization (ASE → LammpsBase, LammpsConcurrent → SingleNodeExecutor, LammpsLibrary → LammpsConcurrent).
Tests: pass hostname_localhost
tests/test_ase_interface.py, tests/test_executor.py, tests/test_base.py, tests/test_concurrent.py, tests/test_pylammpsmpi_local.py
Update test instantiations to pass hostname_localhost=True where libraries/clients are constructed; add unittest.skipIf(platform.system() == "Darwin", ...) to skip two ASE tests on macOS.
Tests: numeric tolerance
tests/test_mpi_backend.py
Update test_get_thermo assertions to compare np.round(..., 8) for both actual and expected values.

Sequence Diagram(s)

sequenceDiagram autonumber participant T as Test / Client participant ASE as LammpsASELibrary participant Lib as LammpsLibrary participant Con as LammpsConcurrent participant Exec as SingleNodeExecutor participant LMP as LammpsBase / MPI T->>ASE: __init__(..., hostname_localhost) ASE->>Lib: build/initialize(..., hostname_localhost) Lib->>Con: __init__(..., hostname_localhost) Con->>Exec: init_function(..., hostname_localhost) Exec->>LMP: start(..., hostname_localhost) Note over LMP,Exec: hostname_localhost propagated for localhost resolution/binding 
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Use executorlib directly #371 — Modifies the same wrapper modules and test sites to add/propagate new initialization parameters and executor/init_function plumbing.

Suggested reviewers

  • srmnitc
  • raynol-dsouza

Poem

I twitch an ear at localhost’s name,
A tiny flag I pass along the frame.
From ASE to MPI I hop and hum,
macOS runners join the drum.
Thump-thump, tests march—one, two—yum. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title “Test macos” is overly generic and does not clearly convey the primary changes in the pull request, which include adding macOS CI jobs for MPICH and OpenMPI as well as introducing a new hostname_localhost parameter across multiple wrappers and tests. While it hints at macOS testing, it fails to specify what is being tested or the significant API changes. As such, it does not provide sufficient context for a reader scanning PR history to understand the main update. Please update the title to be more descriptive, for example: “Add macOS CI jobs for MPICH/OpenMPI tests and hostname_localhost parameter support.”
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.17%. Comparing base (e753fef) to head (1299f7d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@ ## main #381 +/- ## ======================================= Coverage 85.17% 85.17% ======================================= Files 6 6 Lines 796 796 ======================================= Hits 678 678 Misses 118 118 

☔ View full report in Codecov by Sentry.
📢 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.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/test_ase_interface.py (1)

25-34: Set hostname_localhost on LammpsLibrary instantiations
Include hostname_localhost=True when constructing LammpsLibrary so the flag is honored:

- library=LammpsLibrary(cores=2), + library=LammpsLibrary(cores=2, hostname_localhost=True),

Apply to all LammpsLibrary(cores=2) occurrences in tests/test_ase_interface.py.

pylammpsmpi/wrapper/extended.py (1)

255-265: Move hostname_localhost to the end of __init__ to avoid breaking positional calls
Apply:

 def __init__( self, cores: int = 1, oversubscribe: bool = False, working_directory: str = ".", - hostname_localhost: Optional[bool] = None, client: Any = None, cmdargs: Optional[list[str]] = None, executor: Optional[BaseExecutor] = None, + hostname_localhost: Optional[bool] = None, ) -> None:

Also add hostname_localhost to the class docstring’s Args section.

🧹 Nitpick comments (3)
.github/workflows/pipeline.yml (1)

114-133: Consider parity with Linux matrix and longer timeout on macOS.

  • Add a small Python version matrix (e.g., 3.12 alongside 3.13) for macOS to mirror Linux coverage.
  • macOS runners are slower; bump timeout-minutes to 10 to reduce flakiness.
pylammpsmpi/wrapper/ase.py (1)

35-35: Document the new hostname_localhost parameter.

Add it to the Args section so users discover it from the docstring.

pylammpsmpi/wrapper/concurrent.py (1)

76-79: Document the new hostname_localhost parameter and its behavior.

Add it to the init docstring (and note it’s ignored when an external executor is supplied).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1c83e7 and 107a407.

📒 Files selected for processing (9)
  • .github/workflows/pipeline.yml (2 hunks)
  • pylammpsmpi/wrapper/ase.py (2 hunks)
  • pylammpsmpi/wrapper/concurrent.py (2 hunks)
  • pylammpsmpi/wrapper/extended.py (2 hunks)
  • tests/test_ase_interface.py (8 hunks)
  • tests/test_base.py (2 hunks)
  • tests/test_concurrent.py (1 hunks)
  • tests/test_executor.py (1 hunks)
  • tests/test_pylammpsmpi_local.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/test_pylammpsmpi_local.py (1)
pylammpsmpi/wrapper/extended.py (1)
  • LammpsLibrary (242-333)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: unittest_openmpi_mac
🔇 Additional comments (9)
pylammpsmpi/wrapper/ase.py (1)

66-71: Good propagation of hostname_localhost to LammpsBase.

This correctly threads the flag into the multi-core path.

tests/test_concurrent.py (1)

19-21: LGTM: LammpsConcurrent now receives hostname_localhost.

Matches the concurrent wrapper change and executor propagation.

tests/test_executor.py (1)

19-28: LGTM: executor+ASE path covers hostname_localhost.

Both SingleNodeExecutor and LammpsASELibrary get the flag. Good coverage.

tests/test_pylammpsmpi_local.py (2)

20-22: LGTM: LammpsLibrary now receives hostname_localhost.

This ensures the flag reaches LammpsConcurrent in local-mode tests.


119-123: LGTM: SingleNodeExecutor configured with hostname_localhost.

Consistent with the new executor parameter.

pylammpsmpi/wrapper/concurrent.py (1)

106-112: Good: pass hostname_localhost through to SingleNodeExecutor.

This cleanly localizes hostname behavior in the executor.

.github/workflows/pipeline.yml (1)

123-126: Environments omit any Python spec—no constraints conflict with Python 3.13.

tests/test_base.py (1)

22-24: LGTM: LammpsBase inherits init from LammpsConcurrent, which accepts hostname_localhost.

pylammpsmpi/wrapper/extended.py (1)

269-276: LGTM: new parameter is properly forwarded to LammpsConcurrent.

Propagation via hostname_localhost=hostname_localhost is correct.

Comment on lines +114 to +133
unittest_mpich_mac:
needs: [black]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Conda config
run: echo -e "channels:\n - conda-forge\n" > .condarc
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: '3.13'
miniforge-version: latest
condarc-file: .condarc
environment-file: .ci_support/environment-mpich.yml
- name: Test
shell: bash -l {0}
timeout-minutes: 5
run: |
pip install . --no-deps --no-build-isolation
python -m unittest discover tests
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Gate macOS MPI jobs in the merge flow (add to required/needs).

The new macOS jobs aren’t included in the autobot job’s needs (or branch protection). As-is, PRs can auto-merge even if these jobs fail.

Please add unittest_mpich_mac and unittest_openmpi_mac to the gating set (and update repo required checks accordingly).

Also applies to: 157-176

🤖 Prompt for AI Agents
In .github/workflows/pipeline.yml around lines 114-133 (and also update the similar block at 157-176), the new macOS MPI jobs unittest_mpich_mac and unittest_openmpi_mac are not added to the autobot/merge gating needs; update the workflow so the autobot/merge job's needs array includes both unittest_mpich_mac and unittest_openmpi_mac, and then update the repository branch-protection / required checks list to include these two job names so PRs cannot auto-merge until they pass. 
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/test_mpi_backend.py (1)

121-128: Prefer using the unittest float helpers over manual rounding

assertAlmostEqual (or np.testing.assert_allclose) keeps the intent clear, avoids an extra NumPy dependency in the check, and gives better failure diagnostics. Suggest refactoring both assertions accordingly.

- self.assertEqual( - np.round(select_cmd("get_thermo")(job=self.lmp, funct_args=["temp"]), 8), - np.round(1.1298532212880312, 8), - ) + self.assertAlmostEqual( + select_cmd("get_thermo")(job=self.lmp, funct_args=["temp"]), + 1.1298532212880312, + places=8, + ) @@ - self.assertEqual( - np.round(select_cmd("get_thermo")(job=self.lmp, funct_args=["temp"]), 8), - np.round(1.1298532212880312, 8), - ) + self.assertAlmostEqual( + select_cmd("get_thermo")(job=self.lmp, funct_args=["temp"]), + 1.1298532212880312, + places=8, + )
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 107a407 and 387d211.

📒 Files selected for processing (1)
  • tests/test_mpi_backend.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/test_mpi_backend.py (1)
pylammpsmpi/mpi/lmpmpi.py (1)
  • select_cmd (393-443)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: unittest_mpich_mac
  • GitHub Check: unittest_openmpi_mac
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 387d211 and 583cd24.

📒 Files selected for processing (1)
  • tests/test_ase_interface.py (9 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/test_ase_interface.py (1)
pylammpsmpi/wrapper/ase.py (1)
  • LammpsASELibrary (17-465)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: unittest_openmpi_mac
  • GitHub Check: unittest_openmpi (3.13)
  • GitHub Check: unittest_openmpi (3.11)
  • GitHub Check: unittest_openmpi (3.12)
  • GitHub Check: unittest_mpich_mac
  • GitHub Check: coverage
@jan-janssen jan-janssen mentioned this pull request Sep 24, 2025
@jan-janssen jan-janssen merged commit 282f253 into main Sep 24, 2025
34 of 35 checks passed
@jan-janssen jan-janssen deleted the macos branch September 24, 2025 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants