-
Notifications
You must be signed in to change notification settings - Fork 663
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 nightly NumPy cron job, add numpy 1.25-dev0 fixes #3977
Conversation
Codecov ReportBase: 93.48% // Head: 93.49% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #3977 +/- ##
========================================
Coverage 93.48% 93.49%
========================================
Files 190 190
Lines 24951 24963 +12
Branches 3527 3527
========================================
+ Hits 23326 23338 +12
Misses 1102 1102
Partials 523 523
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Looks like we were having numpy conflicts between mamba and pip https://github.com/MDAnalysis/mdanalysis/actions/runs/3739353709/jobs/6346461409#step:6:195 |
right it's fixed, and we've actually picked up a breaking change with the nightly dev versions! |
cube_counter += 1 | ||
|
||
def update_dictionary_end_frame(array_simulation_particle_coordinates, dictionary_cube_data_this_core): | ||
"""Update the cube dictionary objects again as appropriate for the second and final frame.""" | ||
cube_counter = 0 | ||
for key, cube in dictionary_cube_data_this_core.items(): | ||
# if there were no particles in the cube in the first frame, then set dx,dy,dz each to 0 | ||
if cube['centroid_of_particles_first_frame'] == 'empty': | ||
if cube['centroid_of_particles_first_frame'] == None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That took me far too long to narrow down, looks like the issue here was that we are at times doing an array vs str comparison, which until 1.24 led to a scalar return, but now returns an array of bools instead, that in turns messes up this if/else call.
Doing a comparison against None
is probably just safer & more pythonic here?
P.S. Weirdly enough I think this should have thrown an error rather than silently failing i.e. it should have complained about the truth of an array being ambiguous.. but it didn't 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/MDAnalysis/mdanalysis/actions/runs/3824585204/jobs/6506856469 for a successful run.
@MDAnalysis/coredevs this should be good to go I think. Once it's merged I'll cherry pick the changes here and create a 2.4.2 bugfix release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me, thank you for tracking down on all the little things to make it work!
(Minor optional comments below.)
# overwrite installs by picking up nightly wheels | ||
- name: nightly_wheels | ||
run: | | ||
pip install --pre -U -i https://pypi.anaconda.org/scipy-wheels-nightly/simple scipy numpy h5py matplotlib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment: there's a lot of .\\agic hidden in these action files... I would have no idea where to look for these wheels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one of the next major tasks here will be to a) document the CI actions, b) clean them up (it's grown a lot beyond what I initially planned back at the start of last year when I squashed things into using re-usable actions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to add here before I forget - there is a draft SPEC for nightly wheels: https://scientific-python.org/specs/spec-0004/
It needs a lot of fleshing out though...
.github/workflows/gh-ci-cron.yaml
Outdated
pip install --pre -U -i https://pypi.anaconda.org/scipy-wheels-nightly/simple scipy numpy h5py matplotlib | ||
|
||
|
||
- name: check_deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably more accurately named "list deps"
@@ -281,15 +281,15 @@ def update_dictionary_point_in_cube_start_frame(array_simulation_particle_coordi | |||
axis=0) | |||
cube['centroid_of_particles_first_frame'] = centroid_particles_in_cube | |||
else: # empty cube | |||
cube['centroid_of_particles_first_frame'] = 'empty' | |||
cube['centroid_of_particles_first_frame'] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apparently not covered by tests... not sure if this is incorrect or if we must or can cover it but I'll mention it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O that is a bit problematic, we really must cover this. It also means we're getting 'empty' entries being fed somewhere else 🙀 Could you place a blocking review here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aaaaahhh I was wondering why I was getting to print in that branch but CI wasn't picking up forced errors.. we're using multiprocessing 🤦🏽
I'll have a quick look around but it looks like:
a) Errors aren't being propagated from child workers (hence why it didn't raise the relevant "truth of an array" error),
b) Codecov isn't picking up on coverage since it's not being properly logged by the child workers... we do have the multiprocessing thing set in coveragerc, but it's obviously not working
cube_counter += 1 | ||
|
||
def update_dictionary_end_frame(array_simulation_particle_coordinates, dictionary_cube_data_this_core): | ||
"""Update the cube dictionary objects again as appropriate for the second and final frame.""" | ||
cube_counter = 0 | ||
for key, cube in dictionary_cube_data_this_core.items(): | ||
# if there were no particles in the cube in the first frame, then set dx,dy,dz each to 0 | ||
if cube['centroid_of_particles_first_frame'] == 'empty': | ||
if cube['centroid_of_particles_first_frame'] is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment: Looked innocently enough...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised it's the only failure we have! 1.25 is going to cause a lot of trouble for legacy downstream codes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a really similar 'empty' check in
if square_1_centroid == 'empty' or square_2_centroid == 'empty': |
Those probably also need to get changed...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can confirm the same FutureWarning is happening in streamlines :/ the test isn't good enough to pick it up though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test assignment of None
instead of "empty", please.
I'm a little bit confused as to why this specific branch doesn't get covered, it's definitely being entered by some of the workers, and both coverage.py and pytest-cov claim that it should work... I wonder if there's a bad termination happening somewhere else. |
@@ -64,7 +76,7 @@ jobs: | |||
|
|||
- name: run_tests | |||
run: | | |||
pytest -n $numprocs testsuite/MDAnalysisTests --disable-pytest-warnings --durations=50 | |||
pytest -n $numprocs testsuite/MDAnalysisTests --durations=50 -W error::FutureWarning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we'd error on DeprecationWarnings too, but we emit too many of them internally for this to be viable. At least this way we can maybe pick up potential issues?
@@ -176,7 +176,7 @@ def produce_list_centroids_this_frame(list_indices_in_polygon): | |||
list_centroids_this_frame = [] | |||
for indices in list_indices_in_polygon: | |||
if not indices[0].size > 0: # if there are no particles of interest in this particular square | |||
list_centroids_this_frame.append('empty') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as per streamlines_3D, also can't get coverage over it (even though the new test assigns None to everything (hence the zeroed array return)
Ok @orbeckst I think I'm at a point here where codecov is just not playing ball and there's not much else I can think of / find in the docs / issues. I don't understand the problem enough to be able to do a proper bug report either. Short story is that those code branches are being covered, but they aren't being reported for some reason or another. My suggestion at this point is to go with this knowing the above, and not delay 2.4.2 any further. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the digging.
Perhaps add CHANGELOG entry for the internal fix in streamlines and streamlines2D? At a later point in time, this will be an actual error so I think it qualifies for a mentioning — it's a fix for a future error that would have happened.
I might not be following what you mean here @orbeckst, do you mean something else than what has already been added to the 2.4.2 entry for these? |
Ah, sorry — the CHANGELOG checkmark was missing in the top comment (EDIT: I checked it now) and the first file entry was not CHANGELOG (as I was used to) so I wrongly assumed that there was no CHANGELOG entry. My bad. The one you have is perfect. |
Ok now to cherry pick everything into a 2.4.2 release. |
* Fix cron jobs against nightly wheels * Address incompatibilities with NumPy 1.25 changes in streamlines and streamlines_3d
Towards #3980
Changes made in this Pull Request:
PR Checklist