mdanalysis
mdanalysis copied to clipboard
'MDAnalysis.analysis.density' parallelization
Fixes #4677 attempt
Changes made in this Pull Request:
- added backends and aggregators to
DensityAnalysisinanalysis.density - added
client_DensityAnalysisinconftest.py - added
client_DensityAnalysisto the tests intest_density.py
Here again I am not sure for this case, since the Error message:
AttributeError: 'DensityAnalysis' object has no attribute '_grid' appears in the tests and I am not sure if moving _grid and all the code necessary for it from _prepare to __init__ will fix the case like it was the case in #4718
PR Checklist
- [x] Tests?
- [ ] Docs?
- [ ] CHANGELOG updated?
- [x] Issue raised/referenced?
Developers certificate of origin
- [x] I certify that this contribution is covered by the LGPLv2.1+ license as defined in our LICENSE and adheres to the Developer Certificate of Origin.
📚 Documentation preview 📚: https://mdanalysis--4729.org.readthedocs.build/en/4729/
Hello @talagayev! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
- In the file
package/MDAnalysis/analysis/density.py:
Line 426:66: W291 trailing whitespace Line 427:68: W291 trailing whitespace Line 428:36: W291 trailing whitespace
Comment last updated at 2024-12-18 19:05:59 UTC
Linter Bot Results:
Hi @talagayev! Thanks for making this PR. We linted your code and found the following:
Some issues were found with the formatting of your code.
| Code Location | Outcome |
|---|---|
| main package | ⚠️ Possible failure |
| testsuite | ⚠️ Possible failure |
Please have a look at the darker-main-code and darker-test-code steps here for more details: https://github.com/MDAnalysis/mdanalysis/actions/runs/11265261686/job/31326801780
Please note: The black linter is purely informational, you can safely ignore these outcomes if there are no flake8 failures!
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 93.63%. Comparing base (
a3672f2) to head (506597d). Report is 44 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #4729 +/- ##
===========================================
- Coverage 93.65% 93.63% -0.03%
===========================================
Files 177 189 +12
Lines 21774 22845 +1071
Branches 3064 3064
===========================================
+ Hits 20393 21391 +998
- Misses 929 1002 +73
Partials 452 452
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: 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.
Three aspects in my fix.
-
Attributes (private or not) that will be used later in
_concludeshould be defined in__init__, not in_prepare. @marinegor, I think it would be helpful to explicitly mention this in the documentation. Additionally, while the illustrative figure (https://docs.mdanalysis.org/dev/documentation_pages/analysis/parallelization.html#split-apply-combine) suggests that_prepareoccurs before splitting, this is not the case. -
The
_edgesand similar attributes must be defined in__init__by nature because they need to be consistent across all workers and are determined based on the current positions of the atomgroup (https://github.com/MDAnalysis/mdanalysis/pull/4729/files#diff-28b7c110c6231f9f2ea864bbdecb9cb485edbed494d7e266d37896bde7b50b0dR421) . -
The results being aggregated are actually
_grid, notDensity—Densityserves more as a postprocessing step that summarizes the information.
@yuxuanzhuang could you please raise issues for the updates to the parallelization documentation (https://github.com/MDAnalysis/mdanalysis/pull/4729#issuecomment-2403681751) — I think that's very important to make clear, given that we are now repeatedly running in these issues. Thank you!
@yuxuanzhuang thanks, the illustration is indeed wrong, as well as the accompanying text. I fixed them in #4760