Skip to content

issue with iris saver with delayed and dask==2025.4.0 #6417

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

Closed
valeriupredoi opened this issue Apr 23, 2025 · 9 comments
Closed

issue with iris saver with delayed and dask==2025.4.0 #6417

valeriupredoi opened this issue Apr 23, 2025 · 9 comments

Comments

@valeriupredoi
Copy link
Contributor

valeriupredoi commented Apr 23, 2025

Hi folks, apologies I had to renounce the issue template, this is more of a heads up that may need further investigation (it most probably is a Dask issue, as per usual): see ESMValGroup/ESMValCore#2716 and our failed test as of last night with the brand new dask==2025.4.0

/opt/conda/envs/esmvaltool/lib/python3.13/site-packages/iris/io/__init__.py:476: in save
    result = saver(source, target, **kwargs)
/opt/conda/envs/esmvaltool/lib/python3.13/site-packages/iris/fileformats/netcdf/saver.py:2746: in save
    with Saver(filename, netcdf_format, compute=compute) as sman:
/opt/conda/envs/esmvaltool/lib/python3.13/site-packages/iris/fileformats/netcdf/saver.py:437: in __exit__
    self.complete()

self = <iris.fileformats.netcdf.saver.Saver object at 0x7f7a5b668470>

    def complete(self) -> None:
        """Complete file by computing any delayed variable saves.
    
        This requires that the Saver has closed the dataset (exited its context).
    
        """
        if self._dataset.isopen():
            msg = (
                "Cannot call Saver.complete() until its dataset is closed, "
                "i.e. the saver's context has exited."
            )
            raise ValueError(msg)
    
        # Complete the saves now
>       self.delayed_completion().compute()
E       AttributeError: 'tuple' object has no attribute 'compute'

Cheers 🍺

@valeriupredoi
Copy link
Contributor Author

just as a bit extra info:

  • in dask=2025.3 def complete: self.delayed_completion() is a Delayed('store-f38f6909fea4fc14999e3af6962a7863') object
  • in dask=2025.4 that same object becomes a tuple indeed (dask.array<store-map, shape=(), dtype=float64, chunksize=(), chunktype=numpy.ndarray>, dask.array<store-map, shape=(2,), dtype=int64, chunksize=(1,), chunktype=numpy.ndarray>, dask.array<store-map, shape=(), dtype=int64, chunksize=(), chunktype=numpy.ndarray>)

So a completely different API

jfrost-mo added a commit to MetOffice/CSET that referenced this issue Apr 28, 2025
This reverts commit 0ed5b4f.

This change contained a change in Dask that broke saving in the workflow
pre-process task. I'm not quite sure why our tests didn't catch it
however.

See SciTools/iris#6417
@valeriupredoi
Copy link
Contributor Author

Heads up thus continues to be an issue with the latest dask=2025.4.1 gah 😫🍺

@trexfeathers
Copy link
Contributor

We are actively discussing when we can get time to investigate+fix this, I promise we haven't forgotten

@valeriupredoi
Copy link
Contributor Author

valeriupredoi commented May 1, 2025

Take your time, I'm at EGU myself, can't do much from here. But I can dig more and help next week 🍺

@valeriupredoi
Copy link
Contributor Author

@trexfeathers @jfrost-mo brilliant, gents, very many thanks! All good with 3.12.2 - question for you though, do we need a repopatch (pin on Dask) for older irises?

@jfrost-mo
Copy link
Contributor

(I can't take any credit for this fix. I've just been watching and hoping.)

@trexfeathers
Copy link
Contributor

do we need a repopatch (pin on Dask) for older irises?

It's taking too much resource apologising for Dask's frequent breaking changes.

@valeriupredoi
Copy link
Contributor Author

I know, new commercial Dask's killing us too. We've pinned iris to >=3.12.2 (at least in ESMValCore) for now 🍻

jfrost-mo added a commit to jfrost-mo/cset-feedstock that referenced this issue May 9, 2025
This fixes the crashes with dask >= 2025.4.0. See
SciTools/iris#6417 for discussion.
@trexfeathers
Copy link
Contributor

Closed by #6451

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants