diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2017-07-03 17:30:18 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2017-07-04 11:41:37 -0700 |
commit | b4d1654e68880a6c917f8c8e07e6ac2edb6d70ea (patch) | |
tree | e0e3eef5406db20f1be34f7a43a35d694c5b7177 /lib/spack/llnl/util/lock.py | |
parent | bd7a591df17c38d6ce9f51e092364a98ed4c1d7b (diff) | |
download | spack-b4d1654e68880a6c917f8c8e07e6ac2edb6d70ea.tar.gz spack-b4d1654e68880a6c917f8c8e07e6ac2edb6d70ea.tar.bz2 spack-b4d1654e68880a6c917f8c8e07e6ac2edb6d70ea.tar.xz spack-b4d1654e68880a6c917f8c8e07e6ac2edb6d70ea.zip |
Parametrized lock test and make it work with MPI
- Lock test can be run either as a node-local test or as an MPI test.
- Lock test is now parametrized by filesystem, so you can test the
locking capabilities of your NFS, Lustre, or GPFS filesystem. See docs
for details.
Diffstat (limited to 'lib/spack/llnl/util/lock.py')
-rw-r--r-- | lib/spack/llnl/util/lock.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/spack/llnl/util/lock.py b/lib/spack/llnl/util/lock.py index 2cab436e2d..55837c371e 100644 --- a/lib/spack/llnl/util/lock.py +++ b/lib/spack/llnl/util/lock.py @@ -127,8 +127,9 @@ class Lock(object): return - except IOError as error: - if error.errno == errno.EAGAIN or error.errno == errno.EACCES: + except IOError as e: + if e.errno in (errno.EAGAIN, errno.EACCES): + # EAGAIN and EACCES == locked by another process pass else: raise @@ -197,6 +198,8 @@ class Lock(object): tty.debug('READ LOCK: {0.path}[{0._start}:{0._length}] [Acquiring]' .format(self)) self._lock(fcntl.LOCK_SH, timeout=timeout) # can raise LockError. + tty.debug('READ LOCK: {0.path}[{0._start}:{0._length}] [Acquired]' + .format(self)) self._reads += 1 return True else: @@ -219,6 +222,8 @@ class Lock(object): 'WRITE LOCK: {0.path}[{0._start}:{0._length}] [Acquiring]' .format(self)) self._lock(fcntl.LOCK_EX, timeout=timeout) # can raise LockError. + tty.debug('WRITE LOCK: {0.path}[{0._start}:{0._length}] [Acquired]' + .format(self)) self._writes += 1 return True else: |