Skip to content

Commit

Permalink
Revert changes made in #3358 (#3411)
Browse files Browse the repository at this point in the history
* Revert #3358

* Revision

* Code review

* Merge from master

* Obsolescence note
  • Loading branch information
rdoyle45 authored and crusaderky committed Oct 21, 2019
1 parent 3c462b9 commit 2984415
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
6 changes: 6 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ New Features
``pip install git+https://github.com/andrewgsavage/pint.git@refs/pull/6/head)``.
Even with it, interaction with non-numpy array libraries, e.g. dask or sparse, is broken.

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

Documentation
~~~~~~~~~~~~~

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


.. _whats-new.0.14.0:

v0.14.0 (14 Oct 2019)
Expand Down
17 changes: 11 additions & 6 deletions xarray/backends/locks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import multiprocessing
import threading
import weakref
from typing import Any, MutableMapping
from typing import Any, MutableMapping, Optional

try:
from dask.utils import SerializableLock
Expand Down Expand Up @@ -62,7 +62,7 @@ def _get_lock_maker(scheduler=None):
return _LOCK_MAKERS[scheduler]


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

if actual_get is dask.multiprocessing.get:
return "multiprocessing"
else:
return "threaded"
try:
# As of dask=2.6, dask.multiprocessing requires cloudpickle to be installed
# Dependency removed in https://github.com/dask/dask/pull/5511
if actual_get is dask.multiprocessing.get:
return "multiprocessing"
except AttributeError:
pass

return "threaded"


def get_write_lock(key):
Expand Down

0 comments on commit 2984415

Please sign in to comment.