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

Use mamba + pytest-xdist to speed up CI testing #515

Merged
merged 13 commits into from
Nov 2, 2020

Conversation

andersy005
Copy link
Member

Description

This PR attempts to speed the CI setup by using mamba for conda environment creation.

To-Do List

Feel free to add a checklist of steps to be performed while you are working through creating this PR.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Performance (if you touched existing code run asv to detect performance changes)
  • Refactoring

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. This could point to a cell in the updated notebooks. Or a snippet of code with accompanying figures here.

Checklist (while developing)

  • I have added docstrings to all new functions.
  • I have commented my code, particularly in hard-to-understand areas
  • Tests added for pytest, if necessary.
  • I have updated the sphinx documentation, if necessary.
  • Any new functions are added to the API. (See contribution guide)
  • CHANGELOG is updated with reference to this PR.

Pre-Merge Checklist (final steps)

  • I have rebased onto master or develop (wherever I am merging) and dealt with any conflicts.
  • I have squashed commits to a reasonable amount, and force-pushed the squashed commits.

References

Please add any references to manuscripts, textbooks, etc.

@andersy005
Copy link
Member Author

andersy005 commented Oct 27, 2020

Python 3.8

  • Without mamba
    Screen Shot 2020-10-27 at 1 53 10 PM

  • With mamba
    Screen Shot 2020-10-27 at 1 53 28 PM

Python 3.7

  • Without mamba
    Screen Shot 2020-10-27 at 1 50 04 PM

  • With mamba
    Screen Shot 2020-10-27 at 1 49 47 PM

@andersy005 andersy005 changed the title Use mamba to speed up CI testing Use mamba + pytest-xdist to speed up CI testing Oct 27, 2020
@bradyrx
Copy link
Collaborator

bradyrx commented Oct 27, 2020

Wow, that's a great speedup! Makes for quicker development. Always rough when you're waiting on tests to run. Just re-triggered testing since one failed due to pulling data from our climpred-data repo, which just happens sometimes.

@aaronspring
Copy link
Collaborator

Locally I remembered that it wasn't too easy to see which test failed and the corresponding error message when using xdist. Do I remember correctly?

@bradyrx
Copy link
Collaborator

bradyrx commented Oct 27, 2020

Locally I remembered that it wasn't too easy to see which test failed and the corresponding error message when using xdist. Do I remember correctly?

I don't recall trying it honestly. Good thing to look for. Maybe we should force a few tests from different modules to fail, once this is set up and passing.

@bradyrx
Copy link
Collaborator

bradyrx commented Oct 27, 2020

It looks like potentially a pytest-xdist issue with trying to download data? We have a few tests that pull from our climpred-data server and then cache it locally.

@andersy005
Copy link
Member Author

it wasn't too easy to see which test failed and the corresponding error message when using xdist.

I just added the -rf flag when running pytest: pytest -rf. Let me know if the produced output is useful.

It looks like potentially a pytest-xdist issue with trying to download data? We have a few tests that pull from our climpred-data server and then cache it locally.

Sounds like we have a race condition in

def load_dataset(

I will look into this, and hopefully I will find a fix for this issue.

@bradyrx
Copy link
Collaborator

bradyrx commented Oct 28, 2020

@andersy005, maybe there is an issue with multiple instances of the parallel pytest trying to access the FTP/data server at the same time? Or with both trying to cache it? Maybe try turning off cache. I think we have a switch for that in load_dataset.

@bradyrx
Copy link
Collaborator

bradyrx commented Oct 28, 2020

Getting closer. Only 3.6 failed this time 😂 . I just re-ran the tests once more..

@bradyrx
Copy link
Collaborator

bradyrx commented Oct 28, 2020

Might be worth just using mamba for the speedup if there's issues with pytest-xdist accessing cached copies of the tutorial data at the same time. But still open to this if you find a solution!

@andersy005
Copy link
Member Author

andersy005 commented Oct 28, 2020

Getting closer. Only 3.6 failed this time 😂 . I just re-ran the tests once more..

Hehehe.... I disabled pytest-xdist for the time being... Hopefully, we'll figure out a solution in the near future...

Copy link
Collaborator

@bradyrx bradyrx left a comment

Choose a reason for hiding this comment

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

@andersy005 just one question about xesmf/esmpy. Agreed to stick with just mamba now. Thanks for this PR!

ci/requirements/minimum-tests.yml Show resolved Hide resolved
@bradyrx bradyrx merged commit 3179be8 into pangeo-data:master Nov 2, 2020
@bradyrx
Copy link
Collaborator

bradyrx commented Nov 2, 2020

Thanks @andersy005! Lots of solid additions to the CI.

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

Successfully merging this pull request may close these issues.

3 participants