aiida-core icon indicating copy to clipboard operation
aiida-core copied to clipboard

Make with_mpi a strict boolean with default False

Open aman-coder03 opened this issue 3 weeks ago • 4 comments

this PR makes with_mpi a strict boolean with a default value of False, instead of Optional[bool].

updated:

  • data model field to use bool with default False
  • constructor to use bool
  • getter and setter to only accept bool
  • tests to reflect the new behavior

fixes #7082

aman-coder03 avatar Dec 03 '25 16:12 aman-coder03

all the tests pass locally. Please let me know if any changes are needed from my side. Thanks!

aman-coder03 avatar Dec 03 '25 16:12 aman-coder03

Codecov Report

:x: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 29.21%. Comparing base (e79f0a4) to head (24828d6). :warning: Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/aiida/orm/nodes/data/code/abstract.py 60.00% 2 Missing :warning:

:exclamation: There is a different number of reports uploaded between BASE (e79f0a4) and HEAD (24828d6). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (e79f0a4) HEAD (24828d6)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #7122       +/-   ##
===========================================
- Coverage   79.58%   29.21%   -50.37%     
===========================================
  Files         566      566               
  Lines       43520    43474       -46     
===========================================
- Hits        34631    12695    -21936     
- Misses       8889    30779    +21890     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Dec 04 '25 14:12 codecov[bot]

The relevant PR is this one: #6020

As @sphuber explains there, you want to explicitly set a default value (corresponding to something that one could read as "undefined") that is different from an explicit choice of whether MPI is supported or not. If you don't do this, plugin developers would always have to explicitly overwrite it. I think the same applies to the code as well, since AiiDA checks that there are no conflicting values specified.

This is also explained in the relevant part of the code that you can find below:

https://github.com/aiidateam/aiida-core/blob/4e54cd476dd2f089bcb501e9b74ca4b1e8d4f988/src/aiida/engine/processes/calcjobs/calcjob.py#L1016-L1038

t-reents avatar Dec 04 '25 14:12 t-reents

Thanks a lot for the detailed explanation and for linking the relevant PR. I hadn’t considered the need for an explicit “undefined” (None) state to avoid conflicts between user input, plugin requirements, and code defaults. I’m happy to close this PR as it stands. Really appreciate the clarification!

aman-coder03 avatar Dec 04 '25 15:12 aman-coder03