Skip to content

Commit be88121

Browse files
committed
fix process sync example in tutorial
1 parent cfc980a commit be88121

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/tutorial.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ This array is safe to read or write within a multi-threaded program.
342342
Zarr also provides support for process synchronization via file locking,
343343
provided that all processes have access to a shared file system. E.g.::
344344

345-
>>> synchronizer = zarr.ProcessSynchronizer('example.zarr')
346-
>>> z = zarr.open_array('example.zarr', mode='w', shape=(10000, 10000),
345+
>>> synchronizer = zarr.ProcessSynchronizer('example.sync')
346+
>>> z = zarr.open_array('example', mode='w', shape=(10000, 10000),
347347
... chunks=(1000, 1000), dtype='i4',
348348
... synchronizer=synchronizer)
349349
>>> z

zarr/sync.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class ProcessSynchronizer(object):
3333
----------
3434
path : string
3535
Path to a directory on a file system that is shared by all processes.
36+
N.B., this should be a *different* path to where you store the array.
3637
3738
""" # flake8: noqa
3839

@@ -42,7 +43,7 @@ def __init__(self, path):
4243
def __getitem__(self, item):
4344
import fasteners
4445
lock = fasteners.InterProcessLock(
45-
os.path.join(self.path, '%s.lock' % item)
46+
os.path.join(self.path, item)
4647
)
4748
return lock
4849

0 commit comments

Comments
 (0)