File tree Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ Breaking changes
56
56
By `Guido Imperiale <https://github.com/crusaderky >`_ and
57
57
`Stephan Hoyer <https://github.com/shoyer >`_.
58
58
- Pickling a ``Dataset `` or ``DataArray `` linked to a file on disk no longer
59
- caches its values into memory before pickling :issue: `1128 `. Instead, pickle
59
+ caches its values into memory before pickling ( :issue: `1128 `) . Instead, pickle
60
60
stores file paths and restores objects by reopening file references. This
61
61
enables preliminary, experimental use of xarray for opening files with
62
62
`dask.distributed <https://distributed.readthedocs.io >`_.
@@ -206,6 +206,10 @@ Bug fixes
206
206
- Fixed a bug with facetgrid (the ``norm `` keyword was ignored, :issue: `1159 `).
207
207
By `Fabien Maussion <https://github.com/fmaussion >`_.
208
208
209
+ - Resolved a concurrency bug that could cause Python to crash when
210
+ simultaneously reading and writing netCDF4 files with dask (:issue: `1172 `).
211
+ By `Stephan Hoyer <https://github.com/shoyer >`_.
212
+
209
213
.. _whats-new.0.8.2 :
210
214
211
215
v0.8.2 (18 August 2016)
Original file line number Diff line number Diff line change 3
3
from __future__ import print_function
4
4
import gzip
5
5
import os .path
6
- import threading
7
6
from distutils .version import StrictVersion
8
7
from glob import glob
9
8
from io import BytesIO
12
11
import numpy as np
13
12
14
13
from .. import backends , conventions
15
- from .common import ArrayWriter
14
+ from .common import ArrayWriter , GLOBAL_LOCK
16
15
from ..core import indexing
17
16
from ..core .combine import auto_combine
18
17
from ..core .utils import close_on_error , is_remote_uri
@@ -55,9 +54,6 @@ def _normalize_path(path):
55
54
return os .path .abspath (os .path .expanduser (path ))
56
55
57
56
58
- _global_lock = threading .Lock ()
59
-
60
-
61
57
def _default_lock (filename , engine ):
62
58
if filename .endswith ('.gz' ):
63
59
lock = False
@@ -71,9 +67,9 @@ def _default_lock(filename, engine):
71
67
else :
72
68
# TODO: identify netcdf3 files and don't use the global lock
73
69
# for them
74
- lock = _global_lock
70
+ lock = GLOBAL_LOCK
75
71
elif engine in {'h5netcdf' , 'pynio' }:
76
- lock = _global_lock
72
+ lock = GLOBAL_LOCK
77
73
else :
78
74
lock = False
79
75
return lock
Original file line number Diff line number Diff line change 2
2
from __future__ import division
3
3
from __future__ import print_function
4
4
import numpy as np
5
- import itertools
6
5
import logging
7
6
import time
8
7
import traceback
12
11
13
12
from ..conventions import cf_encoder
14
13
from ..core .utils import FrozenOrderedDict
15
- from ..core .pycompat import iteritems , dask_array_type , OrderedDict
14
+ from ..core .pycompat import iteritems , dask_array_type
15
+
16
+ try :
17
+ from dask .utils import SerializableLock as Lock
18
+ except ImportError :
19
+ from threading import Lock
16
20
17
21
# Create a logger object, but don't add any handlers. Leave that to user code.
18
22
logger = logging .getLogger (__name__ )
21
25
NONE_VAR_NAME = '__values__'
22
26
23
27
28
+ # dask.utils.SerializableLock if available, otherwise just a threading.Lock
29
+ GLOBAL_LOCK = Lock ()
30
+
31
+
24
32
def _encode_variable_name (name ):
25
33
if name is None :
26
34
name = NONE_VAR_NAME
@@ -150,7 +158,7 @@ def sync(self):
150
158
import dask .array as da
151
159
import dask
152
160
if StrictVersion (dask .__version__ ) > StrictVersion ('0.8.1' ):
153
- da .store (self .sources , self .targets , lock = threading . Lock () )
161
+ da .store (self .sources , self .targets , lock = GLOBAL_LOCK )
154
162
else :
155
163
da .store (self .sources , self .targets )
156
164
self .sources = []
You can’t perform that action at this time.
0 commit comments