Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter incompatibilities: Increase flexibility in incompatibilities handles. #991

Conversation

VGPReys
Copy link
Contributor

@VGPReys VGPReys commented Sep 2, 2024

You are about to submit a new Pull Request. Before continuing make sure you read the contributing guidelines and that you comply with the following criteria:

  • You have sticked to Python. Please talk to us before adding other programming languages to HADDOCK3
  • Your PR is about CNS
  • Your code is well documented: proper docstrings and explanatory comments for those tricky parts
  • You structured the code into small functions as much as possible. You can use classes if there is a (state) purpose
  • Your code follows our coding style
  • You wrote tests for the new code
  • tox tests pass. Run tox command inside the repository folder
  • -test.cfg examples execute without errors. Inside examples/ run python run_tests.py -b
  • PR does not add any dependencies, unless permission granted by the HADDOCK team
  • PR does not break licensing
  • Your PR is about writing documentation for already existing code 🔥
  • Your PR is about writing tests for already existing code :godmode:

Refactor the way incompatible parameters are handled and written.
Hopefully allows for more flexibility and usage outside of the global parameters.

  • more flexible: multiple incompatible parameters can be set for the same parameter
  • can be used in other modules: when validating modules parameters, incompatible ones are also checked !

Closes #986

How to write an incompatible parameter ?

parameter1:
  default: "value1_X"
  incompatible:
    value1_X:
      parameter2: "value2_Y"
    value1_Y:
      parameter2: "value2_X"
parameter2:
  default: "value2_X"

How to read / write / understand it ?

parameter1 has an incompatibility when its value is value1_X with parameter2=value_Y.
Also, if parameter1 is taking the value value1_Y, parameter2 cannot be set to value2_X.

In this case, the default configuration file is fine, as parameter2 is having value2_X.

But if the user is putting value2_Y for parameter2, an error is thrown !

@VGPReys VGPReys self-assigned this Sep 2, 2024
@VGPReys VGPReys added execution Related to execution modes, such as GRID, HPC, local, etc. bug Something isn't working labels Sep 2, 2024
Copy link
Member

@rvhonorato rvhonorato left a comment

Choose a reason for hiding this comment

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

Held by #987

@rvhonorato rvhonorato dismissed their stale review September 11, 2024 13:55

better implementation of #987

rvhonorato
rvhonorato previously approved these changes Sep 11, 2024
@rvhonorato rvhonorato requested a review from a team September 11, 2024 13:56
@rvhonorato rvhonorato changed the base branch from 986-validate_parameters_are_not_incompatible-ignoring-incompatible-value to main September 11, 2024 13:56
@rvhonorato rvhonorato dismissed their stale review September 11, 2024 13:56

The base branch was changed.

rvhonorato
rvhonorato previously approved these changes Sep 11, 2024
@rvhonorato rvhonorato requested a review from a team September 11, 2024 13:59
@VGPReys VGPReys changed the title Proposing an other way to handle incompatibilities. Increase flexibility in incompatibilities handles. Sep 13, 2024
rvhonorato
rvhonorato previously approved these changes Sep 23, 2024
@VGPReys VGPReys changed the title Increase flexibility in incompatibilities handles. Parameter incompatibilities: Increase flexibility in incompatibilities handles. Sep 26, 2024
@rvhonorato rvhonorato merged commit 70f9a23 into main Oct 1, 2024
5 checks passed
@rvhonorato rvhonorato deleted the 986-validate_parameters_are_not_incompatible-ignoring-incompatible-value-refactor branch October 1, 2024 12:09
@amjjbonvin amjjbonvin restored the 986-validate_parameters_are_not_incompatible-ignoring-incompatible-value-refactor branch October 1, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working execution Related to execution modes, such as GRID, HPC, local, etc.
Projects
Development

Successfully merging this pull request may close these issues.

validate_parameters_are_not_incompatible ignoring incompatible value
4 participants