-
Notifications
You must be signed in to change notification settings - Fork 284
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
[WIP] Changes to make tests pass when using conda forge channel #2440
Conversation
I think that there are a range of reasons why this may well be a sensible approach for us to take. I am keen to hear words of caution and tactical ways to protect ourselves were we to adopt this approach |
imagehash changes: SciTools/test-iris-imagehash#11 |
i am in favour of these changes in principal. I haven't found the time to finish my detail review yet i'd like to encourage comments for key stakeholders about the approach of moving CI testing to conda-forge, which is the purpose of this work are there voices in favour? thoughts please |
The main issue as I see it is that conda forge changes so quickly that we might struggle to keep up with the changes. Additionally, it's pretty gauling if tests start failing because something on the channel changed. This is still an issue with the scitools channel of course, but at least we're in control of that. |
That seems like an advantage to me; having everything "work" because scitools is using a bunch of outdated packages is not really "working". |
I agree with @djkirkham - we should not have to constantly be caught up to the latest everything. Doing so has the danger of introducing a very high workload to Iris devs that would come at the expense of the cessation of new features...
Two things here:
I agree that allowing ourselves to get far behind the latest version of packages is a very bad thing. It is similarly bad, however, to be constantly trying to chase the latest everything, and I'm concerned that conda-forge just moves a little too fast and too unpredictably to be really reliable to base Iris on -- at least, not without some well thought through pinning of some packages. |
You'd have quite a lot of control over the conda-forge channel too, don't forget that. I think it is an advantage to keep up with the conda-forge channel, because that is the one most users are working with, and if iris works there then it is working for a lot of people. |
The key issues seem to be these:
In an offline discussion earlier, the idea emerged to pin key libraries for the tests, but have a process in place to run the tests on the latest conda-forge libraries and notify us of any failures. That way new code could still easily be merged, and we'd be able to keep abreast of changes in conda-forge. Thoughts? |
@djkirkham a useful summary, thank you My present view is that I/we can quickly 'patch' a test failure by pinning a dependency; this gives me/us time to implement an improvement and to then remove the pin
I think this may be more conservative than is required. I would feel comfortable having the tests with no pins (or as few as possible) and to add a pin if a failure mode rears its head. Perhaps a developer rule that doing this should include raising a bug ticket and hoping to fix it in the future Thus, I am advocating a reactive approach. |
lib/iris/coords.py
Outdated
bounds = bounds[keys + (Ellipsis, )] | ||
# Bounds will generally have an extra dimension compared | ||
# to points, so add an Ellipsis at the end, unless there | ||
# is already on, as numpy does not support double Ellipsis. |
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.
Not quite clear: should that be "unless there already is one" ?
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.
Yes, I have corrected 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.
We need to fix the netcdftime screwup properly, not patch around it.
netcdftime.datetime(2000, 7, 21, 4, 48), | ||
netcdftime.datetime(2000, 11, 1, 7, 12), | ||
netcdftime.datetime(2001, 2, 11, 9, 36)] | ||
if netCDF4.__version__ > '1.2.4': |
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.
Really?!
@@ -236,8 +244,12 @@ def test_time_360(self): | |||
time_coord = DimCoord([100.1, 200.2], long_name="time", | |||
units=time_unit) | |||
cube.add_dim_coord(time_coord, 0) | |||
expected_index = [netcdftime.datetime(2000, 4, 11, 2, 24), | |||
netcdftime.datetime(2000, 7, 21, 4, 48)] | |||
if netCDF4.__version__ > '1.2.4': |
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.
Again 😱
Why do we not have a test that picks this up properly rather than having two completely unrelated tests that have two different codepaths based on the version of an unrelated package?
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 feel pretty bad about this approach, but it represents another step in a long line of trying to work with netcdf4python
i think that this is the best of a bad bunch
there is also a particular issue with conda-forge builds of netcdf, not all versions are available as proper builds
further work is required on this, which needs to be planned
#2322
dkillick and I have agreed to push this out to another activity, not to have it as a blocker for this PR
lib/iris/tests/idiff.py
Outdated
e.message)) | ||
continue | ||
else: | ||
raise |
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.
@djkirkham I think that this should be raise e
to propagate the exception, surely?
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.
No, raise
on its own will keep the original stack trace. raise e
would start a new stack trace from here. Minor detail, but it gives an extra bit of debugging information.
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.
Yup, nice. But could you add a comment just to make that subtle point crystal clear to those that follow ... thanks!
@@ -26,12 +26,15 @@ | |||
# importing anything else | |||
import iris.tests as tests | |||
|
|||
import numpy as np | |||
import netcdftime |
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.
@djkirkham Fix the sort order of the imports please
@@ -99,7 +99,6 @@ def setUp(self): | |||
'proleptic_gregorian': np.array(list(range(360, 367)) + | |||
list(range(1, 4))), | |||
'noleap': np.array(list(range(359, 366)) + list(range(1, 4))), | |||
'julian': np.array(list(range(360, 367)) + list(range(1, 4))), |
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.
@marqh ( @djkirkham ) Any idea why this has been removed?
Also, the from cf_units import CALENDARS as calendars
is now no longer used.
There is also a disconnect between the calendars in calendars
and the calendars that this test is covering ... might want to join that up somehow ...
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.
@bjlittle This is because netcdftime julian datetime objects don't give the correct day of year in the latest version; they always give a value of 1.
In fact, some of the other calendar types have the same issue if they are constructed directly:
>>> import netcdftime
>>> ut = netcdftime.utime('days since 1980-12-25', calendar='365_day')
>>> date = ut.num2date(0)
>>> date2 = netcdftime.DatetimeNoLeap(1980, 12, 25)
>>> print repr(date)
netcdftime._netcdftime.DatetimeNoLeap(1980, 12, 25, 0, 0, 0, 0, 2, 359)
>>> print date.dayofyr
359
>>> print date.timetuple()
(1980, 12, 25, 0, 0, 0, 2, 359, -1)
>>> print repr(date2)
netcdftime._netcdftime.DatetimeNoLeap(1980, 12, 25, 0, 0, 0, 0, -1, 1)
>>> print date2.dayofyr
1
>>> print date2.timetuple()
(1980, 12, 25, 0, 0, 0, -1, 1, -1)
All of our datetime objects are constructed using a utime
object (via cf_units) so we avoid this issue with the other calendars.
I think it's probably worth just commenting out the offending line in our tests and having a comment explaining why. Either that, or pin netcdf4.
@djkirkham Where the heck is the travis-ci output ❓ ... 😕 |
@@ -116,6 +116,11 @@ def make_cube(self, calendar): | |||
|
|||
def test_calendars(self): | |||
for calendar in calendars: | |||
# Skip the Julian calendar due to | |||
# https://github.com/Unidata/netcdftime/issues/13 | |||
# Remove this if block once the issue is resolved. |
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.
Is this issue present as a result in changing versions of netcdftime?
If so, would pinning the version of netcdftime be the preferred option until Unidata/cftime#13 is resolved?
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.
A parallel in our own project is where we pin the numpy version to v1.11 until an iris issue is resolved:
#2425
This PR contains a set of changes to make sure the tests pass when installing the environment from the conda-forge channel, with a view to ultimately using that environment for the Travis automated tests.
Due to some issues with cartopy/matplotlib detailed in SciTools/cartopy#848, matplotlib is pinned to 1.*. (The package spec
matplotlib<2
picks up2.0.0rc2
which is inexplicably in the conda-forge channel, so I've pinned it with<1.9
.)In addition to some system and example tests which are still failing, some integration tests will fail using conda-forge until SciTools/iris-grib#75 is merged and a release has been made.