Skip to content

Commit ea72303

Browse files
mrocklinshoyer
authored andcommitted
Fix DataArray.__dask_scheduler__ to threaded scheduler (#1760)
1 parent 3a28b61 commit ea72303

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

doc/whats-new.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Bug fixes
3535

3636
.. _whats-new.0.10.0:
3737

38+
- Properly point DataArray.__dask_scheduler__ to dask.threaded.get
39+
3840
v0.10.0 (20 November 2017)
3941
--------------------------
4042

xarray/core/dataarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ def __dask_optimize__(self):
594594

595595
@property
596596
def __dask_scheduler__(self):
597-
return self._to_temp_dataset().__dask_optimize__
597+
return self._to_temp_dataset().__dask_scheduler__
598598

599599
def __dask_postcompute__(self):
600600
func, args = self._to_temp_dataset().__dask_postcompute__()

xarray/tests/test_dask.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,3 +830,16 @@ def test_dataarray_with_dask_coords():
830830
assert not dask.is_dask_collection(array2)
831831

832832
assert all(isinstance(v._variable.data, np.ndarray) for v in array2.coords.values())
833+
834+
835+
def test_basic_compute():
836+
ds = Dataset({'foo': ('x', range(5)),
837+
'bar': ('x', range(5))}).chunk({'x': 2})
838+
for get in [dask.threaded.get,
839+
dask.multiprocessing.get,
840+
dask.local.get_sync,
841+
None]:
842+
with dask.set_options(get=get):
843+
ds.compute()
844+
ds.foo.compute()
845+
ds.foo.variable.compute()

0 commit comments

Comments
 (0)