Skip to content

Commit 2984415

Browse files
rdoyle45crusaderky
authored andcommitted
Revert changes made in #3358 (#3411)
* Revert #3358 * Revision * Code review * Merge from master * Obsolescence note
1 parent 3c462b9 commit 2984415

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

doc/whats-new.rst

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ New Features
3131
``pip install git+https://github.com/andrewgsavage/pint.git@refs/pull/6/head)``.
3232
Even with it, interaction with non-numpy array libraries, e.g. dask or sparse, is broken.
3333

34+
Bug fixes
35+
~~~~~~~~~
36+
- Fix regression introduced in v0.14.0 that would cause a crash if dask is installed
37+
but cloudpickle isn't (:issue:`3401`) by `Rhys Doyle <https://github.com/rdoyle45>`_
38+
3439
Documentation
3540
~~~~~~~~~~~~~
3641

@@ -39,6 +44,7 @@ Documentation
3944
datetime-like dimension is required. (:pull:`3400`)
4045
By `Justus Magin <https://github.com/keewis>`_.
4146

47+
4248
.. _whats-new.0.14.0:
4349

4450
v0.14.0 (14 Oct 2019)

xarray/backends/locks.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import multiprocessing
22
import threading
33
import weakref
4-
from typing import Any, MutableMapping
4+
from typing import Any, MutableMapping, Optional
55

66
try:
77
from dask.utils import SerializableLock
@@ -62,7 +62,7 @@ def _get_lock_maker(scheduler=None):
6262
return _LOCK_MAKERS[scheduler]
6363

6464

65-
def _get_scheduler(get=None, collection=None):
65+
def _get_scheduler(get=None, collection=None) -> Optional[str]:
6666
"""Determine the dask scheduler that is being used.
6767
6868
None is returned if no dask scheduler is active.
@@ -86,10 +86,15 @@ def _get_scheduler(get=None, collection=None):
8686
except (ImportError, AttributeError):
8787
pass
8888

89-
if actual_get is dask.multiprocessing.get:
90-
return "multiprocessing"
91-
else:
92-
return "threaded"
89+
try:
90+
# As of dask=2.6, dask.multiprocessing requires cloudpickle to be installed
91+
# Dependency removed in https://github.com/dask/dask/pull/5511
92+
if actual_get is dask.multiprocessing.get:
93+
return "multiprocessing"
94+
except AttributeError:
95+
pass
96+
97+
return "threaded"
9398

9499

95100
def get_write_lock(key):

0 commit comments

Comments
 (0)