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

Removed netCDF4 package from integration tests of fixes #938

Merged
merged 3 commits into from
Jan 14, 2021

Conversation

schlunma
Copy link
Contributor

@schlunma schlunma commented Jan 12, 2021

This PR removes the use of the package netCDF4 in test for fixes to avoid segmentation faults.


Before you get started

Checklist


To help with the number pull requests:

@valeriupredoi
Copy link
Contributor

dat was superqwik, cheers Manu! I am having a look and stress test now 👍

@valeriupredoi
Copy link
Contributor

valeriupredoi commented Jan 12, 2021

good job with the PR @schlunma 👍 🍺

I reckon this is good to have and we need to move on understanding the iris-dask animosity from #644 but that's not the scope of this PR 👍

@bouweandela or @stefsmeets or @jvegasbsc one of you guys wanna have a look to so we have three pairs of eyes? If not good to go, Manu!

@schlunma
Copy link
Contributor Author

Cheers V, thanks for reviewing! 🍺

* minor comment: there is one more import of `netCDF4` in `tests/integration/cmor/_fixes/sample_data/create_sample_data.py` - do we want that changed too?

Nope, we can't get rid of that since those (faulty) data cannot be produced with iris. However, this should not matter since this script is not used during the test. I only used it to create the sample data and I thought it would be good to keep it in the repo 👍

@valeriupredoi
Copy link
Contributor

Cheers V, thanks for reviewing! beer

* minor comment: there is one more import of `netCDF4` in `tests/integration/cmor/_fixes/sample_data/create_sample_data.py` - do we want that changed too?

Nope, we can't get rid of that since those (faulty) data cannot be produced with iris. However, this should not matter since this script is not used during the test. I only used it to create the sample data and I thought it would be good to keep it in the repo +1

excellent! Let's wait until tomorrow morning see if any of the other folks want to have a look, if no answer, fire it to master, bud! 🍺

Copy link
Contributor

@stefsmeets stefsmeets left a comment

Choose a reason for hiding this comment

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

Hi @schlunma , nice work, looks much cleaner!

  1. The definition of the SAMPLE_PATH variable is repeated at the top of every file. It would be nice if this could be single-sourced. Also, would it be possible for you to change the definition from using os.path to pathlib.Path while at it (I already made a few starts)? This will be much easier to work with and maintain.

  2. Could you put the scripts to generate the .nc files somewhere (maybe directly in the sample_data directory) so that the data can be regenerated or updated if needed?

  3. Finally, we already have a set of tests with sample data here: https://github.com/ESMValGroup/ESMValCore/tree/master/tests/sample_data/ . Could we call your directory test_data to avoid a name clash?

@valeriupredoi
Copy link
Contributor

@stefsmeets very good idea about adding instructions how to create those standard test files, cheers! About Pathlib - you know me, am impartial 😁
More generally speaking, I need to put together a small reproducible test that replicates the issue related to data realization when run on multiple threads and the SegFault we get so we can ship it to the iris folk - will do this now 👍

@valeriupredoi
Copy link
Contributor

let's get this one done and merged, I'd like to continue the fixing trials by reducing the size of tests, am fairly sure it's the size of the tests that's causing the SegFaults as I say in this comment - Manu, if you don't have time I can tend to Stef's comments 👍

@schlunma
Copy link
Contributor Author

I already addressed them and will push them after the meeting 👍

@valeriupredoi
Copy link
Contributor

I already addressed them and will push them after the meeting +1

total boss! 🍺

@schlunma
Copy link
Contributor Author

Thanks for the review @stefsmeets !

1. The definition of the `SAMPLE_PATH` variable is repeated at the top of every file. It would be nice if this could be single-sourced. Also, would it be possible for you to change the definition from using `os.path` to `pathlib.Path` while at it (I already made a few starts)? This will be much easier to work with and maintain.

I changed os.path to pathlib and moved the sample path to a fixture in conftest.py. I'm quite happy with pathlib, although it's a pity that iris can't handle Path objects at the moment.

2. Could you put the scripts to generate the `.nc` files somewhere (maybe directly in the `sample_data` directory) so that the data can be regenerated or updated if needed?

The script is already there: tests/integration/cmor/_fixes/test_data/create_test_data.py

3. Finally, we already have a set of tests with sample data here: https://github.com/ESMValGroup/ESMValCore/tree/master/tests/sample_data/ . Could we call your directory `test_data` to avoid a name clash?

Renamed to test_data.

@valeriupredoi
Copy link
Contributor

valeriupredoi commented Jan 14, 2021

good job @schlunma - this change reduces the statistical rate of SegFaults from 16% to 5/80=6% (16% from this comment)

@stefsmeets stefsmeets self-requested a review January 14, 2021 13:41
Copy link
Contributor

@stefsmeets stefsmeets left a comment

Choose a reason for hiding this comment

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

Cheers @schlunma , I must have missed the script to generate the data on my first pass (I think the diff was probably too big for it to show 😅). Nice work, hope this helps reduce the number of seg faults!

@schlunma schlunma merged commit 3a9cb65 into master Jan 14, 2021
@schlunma schlunma deleted the remove_netCDF4_from_tests branch January 14, 2021 14:08
@valeriupredoi
Copy link
Contributor

cheers @schlunma and @stefsmeets 🍺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants