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

Fix issue #236 #237

Merged
merged 7 commits into from Feb 7, 2024
Merged

Fix issue #236 #237

merged 7 commits into from Feb 7, 2024

Conversation

lohedges
Copy link
Contributor

@lohedges lohedges commented Feb 5, 2024

This PR closes #236 and closes OpenBioSim/biosimspace_tutorials#23. This is achieved by making the _generate_binary_run_file method static, so that it can be called externally, e.g. during the BioSimSpace.FreeEnergy.Relative setup process. This is tested via the existing BioSimSpace tests, as well as the tutorial notebook for which the original issue was posted.

  • I confirm that I have merged the latest version of devel into this branch before issuing this pull request (e.g. by running git pull origin devel): [y]
  • I confirm that I have permission to release this code under the GPL3 license: [y]

Suggested reviewers:

@chryswoods

@lohedges lohedges added the bug Something isn't working label Feb 5, 2024
@lohedges
Copy link
Contributor Author

lohedges commented Feb 5, 2024

Actually, I need to adjust the port to the Exscientia Sandpit since they allow the use of a reference coordinate file for the position restraints. (This isn't covered in the tests.) The failures are the existing random search failure that only occurs on the CI (intermittently) for certain Python variants on Linux.

@lohedges
Copy link
Contributor Author

lohedges commented Feb 5, 2024

Okay, looks like I'll need to remove the black check on Python 3.9 since it's now using functionality that's deprecated.

The Windows error is weird. It seems to be repeatedly failing to read certain files that were fine before. No changes are related to these.

@lohedges
Copy link
Contributor Author

lohedges commented Feb 5, 2024

The Windows failure appears to be a different file each time. I'm wondering if it's a RAM or storage issue during conda build. Trying to see if any of the runner settings have changed.

@lohedges
Copy link
Contributor Author

lohedges commented Feb 6, 2024

Now the Python 3.9 import test is repeatedly failing on Linux. (No error printed unfortunately.) Will need to debug locally to see what the issue is. Possibly some deprecated functionality in one of our dependencies?

@lohedges
Copy link
Contributor Author

lohedges commented Feb 6, 2024

The Windows issue appears to have magically fixed itself. The other failure is due to deprecated functionality in pytest 8 now rasing an exception. I'll need to pin to version 7 until pytest-black is updated. That said, it might be worth thinking about removing this from the build and using something like pre-commit instead.

@lohedges
Copy link
Contributor Author

lohedges commented Feb 6, 2024

Having fixed that, I now see the weird search result error on two builds 🤦‍♂️

FAILED tests/Sandpit/Exscientia/_SireWrappers/test_system.py::test_restraint_atoms[backbone-expected0] - assert [6, 8, 14, 15, 16] == [4, 5, 6, 8, 14, 15, 16]
  At index 0 diff: 6 != 4
  Right contains 2 more items, first extra item: 15
  Full diff:
  - [4, 5, 6, 8, 14, 15, 16]
  ?  ------
  + [6, 8, 14, 15, 16]
FAILED tests/_SireWrappers/test_system.py::test_restraint_atoms[backbone-expected0] - assert [6, 8, 14, 15, 16] == [4, 5, 6, 8, 14, 15, 16]
  At index 0 diff: 6 != 4
  Right contains 2 more items, first extra item: 15
  Full diff:
  - [4, 5, 6, 8, 14, 15, 16]
  ?  ------
  + [6, 8, 14, 15, 16]

@lohedges
Copy link
Contributor Author

lohedges commented Feb 6, 2024

And now everything passes 🤷‍♂️

@chryswoods
Copy link
Contributor

Strange - I agree about switching to pre-commit. I moved to ruff locally, and its very small differences to black cause occasional reformats (and "reformat wars" on commonly edited files). A pre-commit would give us a canonical format that would be independent of person and IDE (i.e. independent of my local changes and inconsistencies ;-))

chryswoods
chryswoods previously approved these changes Feb 6, 2024
Copy link
Contributor

@chryswoods chryswoods left a comment

Choose a reason for hiding this comment

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

Looks good - I tend to use Class.static_function() when calling static functions, rather than self.static_function(), as it makes it more obvious that a static function is being called. On my quick scan I didn't get why we were passing lots of state from self into a self.function().

i.e. I would use Gromacs._generate_binary_run_file(self._config_file...) rather than self._generate_binary_run_file(self._config_file...).

This is just my personal preference. I'm happy if you disagree and want to keep it as is.

@lohedges
Copy link
Contributor Author

lohedges commented Feb 7, 2024

In this use case I create an initial process that is the reference for the others, hence re-use all of its attributes when re-running grompp, e.g. making sure we use the same executable, etc. As the instance exists, I just called the method on it. I agree it would be clearer to just call on the class directly.

@lohedges lohedges merged commit 286a467 into devel Feb 7, 2024
5 checks passed
@lohedges lohedges deleted the fix_236 branch February 7, 2024 10:02
lohedges added a commit that referenced this pull request Feb 7, 2024
lohedges added a commit that referenced this pull request Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants