-
Notifications
You must be signed in to change notification settings - Fork 298
Lockfile updates plus adapt to Dask changes to delayed and internals #6438
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6438 +/- ##
=======================================
Coverage 89.80% 89.80%
=======================================
Files 90 90
Lines 23752 23752
Branches 4418 4418
=======================================
Hits 21331 21331
Misses 1672 1672
Partials 749 749 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
⏱️ Performance Benchmark Report: 755a7cdPerformance shiftsFull benchmark resultsGenerated by GHA run |
| def is_pp_layer(obj): | ||
| result = False | ||
| if hasattr(obj, "values"): | ||
| if len(obj) == 1: | ||
| (result,) = [hasattr(v, "_lbpack") for v in obj.values()] | ||
| return result | ||
|
|
||
| # Find the single reference to the PPDataProxy within the dask graph. | ||
| (layer,) = [ | ||
| lay for lay in lazy_mask_array.dask.layers.values() if is_pp_layer(lay) | ||
| ] | ||
| ((layer_key, proxy),) = layer.items() | ||
| # Replace the PPDataProxy with a mock. | ||
| # By replacing directly within the dask graph, we can prove whether an | ||
| # operation is relying on the graph in the expected way. | ||
| mock_proxy = mock.MagicMock(spec=pp.PPDataProxy, wraps=proxy) | ||
| layer.mapping[layer_key] = mock_proxy | ||
|
|
||
| self.assertFalse(mock_proxy.__getitem__.called) | ||
| with contextlib.suppress(TypeError): | ||
| # Expect this to crash - data realisation is complex, and it is not | ||
| # worth mocking this fully. | ||
| _ = lazy_soildata_array.compute() | ||
| # Proves that the soil data graph includes the mask graph - computing | ||
| # the soil data has accessed the mask graph object which we mocked. | ||
| self.assertTrue(mock_proxy.__getitem__.called) |
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.
This change in approach is more agnostic to Dask's internals (although still somewhat vulnerable). It successfully runs, only failing in a classic test failure rather than falling over.
But all I have managed to do is prove that Dask >=2025.4.0 breaks this test on a philosophical level - not just because the structures have changed.
Results of updated test
fileformats/pp.py |
Dask version | Pass/Fail | what this proves |
|---|---|---|---|
v2.2.0 |
2025.3.0 |
Fail ❌ | |
| #3255 | 2025.3.0 |
Pass ✔ | The updated test still detects the case it was designed for |
main |
2025.3.0 |
Pass ✔ | |
main |
2025.4.0 |
Fail ❌ | The Dask graph for the data payload no longer incorporates the mask graph |
Understanding if this is cause for concern - and if so, how to fix things - will be complex. The development team are fully booked on other projects for the foreseeable, so I would suggest a patch release with a dask < 2025.4 pin. @SciTools/iris-devs what are your thoughts?
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.
Discussed at length with @pp-mo, who explained that this test was not written to demonstrate the other changes in #3255, but because there was a concern about something else similar happening again.
Our increased experience with Dask in the 6 years since has given us the confidence that:
- We now write code that is much less vulnerable to things like Don't nest compute calls #3237
- Dask itself has matured, and is less vulnerable to unexpected corner cases
It looks like the refactoring that made this test fail (dask/dask#11736) was technical debt work to make Dask safer and more robust, and is NOT evidence that we have become vulnerable to nested compute() calls.
Based on all of this, we have decided to remove the test.
⏱️ Performance Benchmark Report: 2df2034Performance shiftsFull benchmark resultsGenerated by GHA run |
|
The performance shifts are most pronounced with smaller data sizes, becoming smaller as the data gets larger. This indicates increased overhead in setting up objects - perhaps dask/dask#11736 - but not something any part of the code that scales with data size. The impact will therefore remain in the milliseconds, even for very large data payloads, and is not a concern (agreed with @pp-mo). |
|
Note I am now targetting the changes for a patch release (#6451), which we can then merge back that should unblock future lock-file PRs |
|
Closed by #6412 |
🚀 Pull Request
Description
array.compute()todask.compute(array)#6437Consult Iris pull request check list
Add any of the below labels to trigger actions on this PR: