Skip to content

Fix DataArray.__dask_scheduler__ to point to dask.threaded.get #1760

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

Merged
merged 1 commit into from
Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Bug fixes

.. _whats-new.0.10.0:

- Properly point DataArray.__dask_scheduler__ to dask.threaded.get

v0.10.0 (20 November 2017)
--------------------------

Expand Down
2 changes: 1 addition & 1 deletion xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def __dask_optimize__(self):

@property
def __dask_scheduler__(self):
return self._to_temp_dataset().__dask_optimize__
return self._to_temp_dataset().__dask_scheduler__

def __dask_postcompute__(self):
func, args = self._to_temp_dataset().__dask_postcompute__()
Expand Down
13 changes: 13 additions & 0 deletions xarray/tests/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,3 +830,16 @@ def test_dataarray_with_dask_coords():
assert not dask.is_dask_collection(array2)

assert all(isinstance(v._variable.data, np.ndarray) for v in array2.coords.values())


def test_basic_compute():
ds = Dataset({'foo': ('x', range(5)),
'bar': ('x', range(5))}).chunk({'x': 2})
for get in [dask.threaded.get,
dask.multiprocessing.get,
dask.local.get_sync,
None]:
with dask.set_options(get=get):
ds.compute()
ds.foo.compute()
ds.foo.variable.compute()