-
Notifications
You must be signed in to change notification settings - Fork 300
Stop dask state change on Iris import #2870
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
|
Closes #2739. |
lib/iris/_lazy_data.py
Outdated
| """ | ||
| dask_opts = {} | ||
| if 'pool' not in dask.context._globals and \ |
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'd probably guard about accessing dask.context._globals. They could legitimately remove this and leave iris unable to load data... 🤒
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.
(to be clear, in this context I simply mean getattr(dask.context, '_globals'))
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.
Given the nature of this API (private), I'd also be tempted to add a test that asserts dask's set_opt behaviour continues to be a valid assumption in dask.context._globals.
|
@pelson I had a sneaky extra 10min, so I implemented the changes you suggested 😎 |
pelson
left a comment
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.
Thanks for updating @dkillick. Good use of a sneaky 10 mins 😄
| _iris_dask_defaults() | ||
| dask_opts = {} | ||
| dask_globals = getattr(dask.context, '_globals') | ||
| if dask_globals is not None: |
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.
So if dask change their dask.context._globals storage location, we let dask give us the default engine. Is that what is intended?
| # We may need to unset a previously-set default. | ||
| if dask_opts.get('get') is not None: | ||
| dask_opts = {key: value for key, value in dask_opts.items() | ||
| if key != 'get'} |
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'm trying to understand why the get is not used from the dask options. I think this comes down to my not-understanding the dask globals and what they actually mean...
|
Deferring for now. #2879 removes the default change, and we can re-introduce a different default when we have a "smoking gun"/evidence of need to divert from dask's defaults. |
We have chosen to set default Iris behaviour to use only one thread when processing dask graphs initially. This was done by setting the global dask state using
dask.set_options(). This is far from ideal as it means Iris is changing dask state; a situation that should not be. This PR updates the system for setting dask processing options so that behaviour is maintained without changing dask state.