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

Replace pyke nopyke #4198

Merged
merged 53 commits into from
Jul 1, 2021
Merged

Replace pyke nopyke #4198

merged 53 commits into from
Jul 1, 2021

Conversation

pp-mo
Copy link
Member

@pp-mo pp-mo commented Jun 15, 2021

🚀 Pull Request

Encompasses all of the work in #4170, but further changes now complete the removal of pyke, switch all loading to 'new' mechanisms, and simplify all the testing that used to perform new/old comparison testing.

I probably should have squashed the commits from #4170 , but instead I squashed what was formerly here to aid rebase/merge.


Consult Iris pull request check list

@pp-mo
Copy link
Member Author

pp-mo commented Jun 15, 2021

Sorry, for clarity should be targetting the #4170 branch ... will replace ...

@pp-mo pp-mo closed this Jun 15, 2021
@pp-mo pp-mo reopened this Jun 15, 2021
@pp-mo
Copy link
Member Author

pp-mo commented Jun 15, 2021

Reopened because pp-mo#69 won't run tests.

@pp-mo pp-mo mentioned this pull request Jun 15, 2021
@pp-mo
Copy link
Member Author

pp-mo commented Jun 22, 2021

Rebased, to see how it goes

@pp-mo
Copy link
Member Author

pp-mo commented Jun 22, 2021

re-merged with auto commit from pre-commit.ci, and added small change to run local pre-commit process

? This seems to have been necessary to satisfy CI pre-commit process after rebasing, as it won't apply automatic Black changes.
Or maybe it's because the black version updated ??

@trexfeathers
Copy link
Contributor

@pp-mo from what I can see it was isort changes that needed to be applied.

@pp-mo
Copy link
Member Author

pp-mo commented Jun 22, 2021

@trexfeathers from what I can see it was isort changes that needed to be applied.

Actually, the failing 'pre-commit' initially showed a merge-check failure.
But now it seems to be showing something different -- as you can see by navigating from the red cross.
Maybe it was due to change and I looked at it too soon (it had not finished all other tests).

I don't really understand why we seem to be doing this twice : once in the "pre-commit.ci" test, and once in the "black, flake8 and isort". I thought one test had made the other obsolete ?
Can you explain what this actually means @trexfeathers ?

@trexfeathers
Copy link
Contributor

I don't really understand why we seem to be doing this twice : once in the "pre-commit.ci" test, and once in the "black, flake8 and isort". I thought one test had made the other obsolete ?
Can you explain what this actually means @trexfeathers ?

In short: no 😄. I actually raised the same question with @bjlittle earlier today.

@bjlittle
Copy link
Member

bjlittle commented Jun 23, 2021

I'll take a look at this... the only advantage of doing it locally is that the round-trip time to detecting a failure and fixing it is shorter i.e., on your git commit you find a problem, rather than committing, pushing and waiting for the pre-commit.ci bot to barf

I'll see what I can do... perhaps there is a compromise here, but I agree it making developer git commits painful

@pp-mo
Copy link
Member Author

pp-mo commented Jun 23, 2021

Rebased.
next intending to merge these changes back into #4170
See comment there

@pp-mo
Copy link
Member Author

pp-mo commented Jun 23, 2021

making developer git commits painful

nothing particularly to do with this PR.
But a key problem now is that nothing happens automatically when you rebase - e.g. latest on #4170
Which is one time I really did prefer to let the CI do the work.

@pp-mo
Copy link
Member Author

pp-mo commented Jun 23, 2021

I have now merged this with #4170
I had to squash the previous commits here, but it was not that complicated.
A certain amount of manual resolution was needed, in view of subsequent changes and additions on #4170 .
This should now work, but we'll see if tests pass ...

@pp-mo pp-mo marked this pull request as ready for review June 23, 2021 14:46
@pp-mo
Copy link
Member Author

pp-mo commented Jun 23, 2021

Ooh. That's nasty.
The recently-added testcase for what happens if you have a variable with two hybrid coords is failing under py37 and ok under py38.
But it turns out there is an indeterminacy in the order in which it processes the coords, presumably down to the use of sets in netcdf.py.
So for me, it literally succeeds on some runs and fails on others ...

$ python -m unittest discover ./lib/iris/tests/unit/fileformats/nc_load_rules
..........................................F............................................................................................................./home/h05/itpp/git/iris/iris_main/lib/iris/fileformats/_nc_load_rules/helpers.py:643: UserWarning: Ignoring netCDF variable 'sound_frequency' invalid units '♫'
  warnings.warn(msg)
.....................................
======================================================================
FAIL: test_two_formulae (actions.test__hybrid_formulae.Test__formulae_tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/net/home/h05/itpp/git/iris/iris_main/lib/iris/tests/unit/fileformats/nc_load_rules/actions/test__hybrid_formulae.py", line 239, in test_two_formulae
    formula_terms=["a", "b", "depth", "eta", "orog", "sigma"],
  File "/net/home/h05/itpp/git/iris/iris_main/lib/iris/tests/unit/fileformats/nc_load_rules/actions/test__hybrid_formulae.py", line 117, in check_result
    self.assertEqual(cube._formula_type_name, factory_type)
AssertionError: 'atmosphere_hybrid_height_coordinate' != 'ocean_sigma_coordinate'
- atmosphere_hybrid_height_coordinate
+ ocean_sigma_coordinate


----------------------------------------------------------------------
Ran 189 tests in 2.954s

FAILED (failures=1)

$ python -m unittest discover ./lib/iris/tests/unit/fileformats/nc_load_rules
......................................................................................................................................................../home/h05/itpp/git/iris/iris_main/lib/iris/fileformats/_nc_load_rules/helpers.py:643: UserWarning: Ignoring netCDF variable 'sound_frequency' invalid units '♫'
  warnings.warn(msg)
.....................................
----------------------------------------------------------------------
Ran 189 tests in 2.481s

OK
$ 

( and the same for running just that specific test :
python ./lib/iris/tests/unit/fileformats/nc_load_rules/actions/test__hybrid_formulae.py Test__formulae_tests.test_two_formulae )

And I presume, the old code is quite probably doing the same, so the load will randomly return one coord with a factory and not the other.
Ouch 😱

@pp-mo
Copy link
Member Author

pp-mo commented Jun 23, 2021

Nearly there. I'm just scanning what is introduced, and correcting some comments.

lib/iris/fileformats/netcdf.py Outdated Show resolved Hide resolved
@stephenworsley
Copy link
Contributor

I suspect that the test currently failing is due to a failure elsewhere. The warning message causing a failure seems to be raised due to garbage collection of an Animation object (probably created during this test

def test_cube_animation(self):
). I would imagine that the error can be considered unrelated and would go away after respinning the test, though it may be worth raising another issue to investigate the source.

@stephenworsley
Copy link
Contributor

Shouldn't this line be removed from setup.cfg?

iris/setup.cfg

Line 126 in af13e14

compiled_krb,

@stephenworsley
Copy link
Contributor

Also, shouldn't

iris/pyproject.toml

Lines 35 to 36 in 9a06485

"compiled_krb",
"fc_rules_cf.krb",
also be removed?

@pp-mo
Copy link
Member Author

pp-mo commented Jun 30, 2021

Shouldn't this line [[iris/setup.cfg:: 26]] be removed from setup.cfg?
Also, shouldn't .. [[iris/pyproject.toml:: 35-36]] also be removed?

👍 Whoops.

I think missed these, because they don't mention Pyke directly.
I'll do another search + fix those things...

@pp-mo
Copy link
Member Author

pp-mo commented Jun 30, 2021

Thanks @stephenworsley .
Hope I have now addressed all the outstanding comments.
Please re-review.

@pp-mo
Copy link
Member Author

pp-mo commented Jul 1, 2021

Some further small changes, as requested.
Thanks for your conscientious application + patience @stephenworsley !

Copy link
Contributor

@stephenworsley stephenworsley left a comment

Choose a reason for hiding this comment

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

I think this looks good now, all my comments have been addressed and I'd be happy with merging this now.

@stephenworsley stephenworsley merged commit dccb6a5 into SciTools:main Jul 1, 2021
@bjlittle bjlittle mentioned this pull request Jul 7, 2021
tkknight added a commit to tkknight/iris that referenced this pull request Jul 21, 2021
* main: (43 commits)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4244)
  Updated environment lockfiles (SciTools#4242)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4239)
  Documented the --force option on conda env create (SciTools#4240)
  Updated environment lockfiles (SciTools#4237)
  pre-commit isort and black --check only for cirrus-ci (SciTools#4235)
  Only run docs-building sessions with Python 3.8. (SciTools#4210)
  consolidate cirrus-ci documentation tasks (SciTools#4219)
  Updated environment lockfiles (SciTools#4223)
  Replace pyke nopyke (SciTools#4198)
  drop cirrus-ci minimal tests (SciTools#4218)
  remove change management tech paper (SciTools#4217)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4213)
  Updated environment lockfiles (SciTools#4212)
  Widen cube printout for long ancil or cell-measure names. (SciTools#4124)
  convert docs print statements (SciTools#4209)
  optimise pre-commit (SciTools#4208)
  drop black and flake8 dependencies (SciTools#4181)
  pre-commit blacked docs (SciTools#4205)
  pre-commit update (SciTools#4204)
  ...
@pp-mo pp-mo deleted the replace_pyke_nopyke branch March 18, 2022 15:48
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.

4 participants