Skip to content
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

Revert changes made in #3358 #3411

Merged
merged 7 commits into from
Oct 21, 2019
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
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