eurec4a / eurec4a-intake

Intake catalogue for EUREC4A field campaign datasets
17 stars 19 forks source link

Speed up tests #75

Closed d70-t closed 2 years ago

d70-t commented 2 years ago

We need to find a way to speed up tests, as the catalog now (at least since #74) grows so large that re-testing everything might not be a sensible choice anymore.

Probably useful ideas:

RobertPincus commented 2 years ago

@d70-t I like both these ideas, but I'm not sure how to implement either of them.

RobertPincus commented 2 years ago

@d70-t @leifdenby I'm not a pytest guru but could this be accomplished with a Github matrix that listed each of the subcatalogs? Something like:

    strategy:
      matrix:
        platform:  [Atalante, ATR, barbados, Boreal, ...]

Tests will be run independent for each element of the platform vector. The invocation of pytest would then have to accept a keyword argument that restricted the tests to that platform... but I don't know how to do that.

RobertPincus commented 2 years ago

Closed by #76 though there's surely room for improvement.

leifdenby commented 2 years ago

@RobertPincus sorry for the slow reply here, and thanks for working on this!

A better approach I think would be to use pytest-xdist,

pytest -n <n_cpus>

There are two drawbacks with the merged approach 1) it assumes a folder structure of the repo and so if we add new directories these won't be included in the test, which is bad, and tests will break if folders are renamed and 2) it spawns a new testing instance for each platform which is quite wasteful (for every one of these there's a new conda environment created, pip installs, etc...). I think we should switch to pytest-xdist instead. I'll make a pull-request and see what number of parallel requests against AERIS we can get away with and we can merge it if you are both ok with it.