summaryrefslogtreecommitdiff
path: root/lib/spack/llnl/util/lock.py
AgeCommit message (Collapse)AuthorFilesLines
2016-10-11Fix bug with lock upgrades.Todd Gamblin1-12/+16
- Closing and re-opening to upgrade to write will lose all existing read locks on this process. - If we didn't allow ranges, sleeping until no reads would work. - With ranges, we may never be able to take some legal write locks without invalidating all reads. e.g., if a write lock has distinct range from all reads, it should just work, but we'd have to close the file, reopen, and re-take reads. - It's easier to just check whether the file is writable in the first place and open for writing from the start. - Lock now only opens files read-only if we *can't* write them.
2016-10-11Add byte-range parameters to llnl.util.lockTodd Gamblin1-19/+40
2016-10-11Remove need to touch lock files before using.Todd Gamblin1-12/+60
- Locks will now create enclosing directories and touch the lock file automatically.
2016-10-11Make llnl.util.lock use file objects instead of low-level OS fds.Todd Gamblin1-17/+19
- Make sure we write, truncate, flush when setting PID and owning host in the file.
2016-10-11install : finer graned locking for install commandalalazo1-0/+8
2016-10-04Read-only locks should close fd before opening for write. (#1906)Todd Gamblin1-0/+8
- Fixes bad file descriptor error in lock acquire, #1904 - Fix bug introduced in previous PR #1857 - Backported fix from soon-to-be merged fine-grained DB locking branch.
2016-09-30Fix read locks on read-only file systems (#1857)Michael Kuhn1-1/+2
2016-08-10Make Spack core PEP8 compliant.Todd Gamblin1-0/+3
2016-08-09Properly re-raise exceptions from lock context handler.Todd Gamblin1-4/+6
2016-08-09Flake8 fixesTodd Gamblin1-8/+10
2016-08-09Move provider cache to home directory and refactor TransactionsTodd Gamblin1-2/+67
Major stuff: - Created a FileCache for managing user cache files in Spack. Currently just handles virtuals. - Moved virtual cache from the repository to the home directory so that users do not need write access to Spack repositories to use them. - Refactored `Transaction` class in `database.py` -- moved it to `LockTransaction` in `lock.py` and made it reusable by other classes. Other additions: - Added tests for file cache and transactions. - Added a few more tests for database - Fixed bug in DB where writes could happen even if exceptions were raised during a transaction. - `spack uninstall` now attempts to repair the database when it discovers that a prefix doesn't exist but a DB record does.
2016-05-11Correct LLNL LGPL license template for clarity.Todd Gamblin1-8/+8
2015-12-09Change github.com/scalability-llnl to github.com/llnl everywhere.Todd Gamblin1-1/+1
2015-10-27Fix stupid lock bug.Todd Gamblin1-16/+24
- Code simplification ignored case where exception was raised. - If LockError was raised, read and write counts were incremented erroneously. - updated lock test.
2015-10-27Lock acquires return True/False depending on whether they got POSIX lock.Todd Gamblin1-4/+15
2015-10-24Working Lock class, now uses POSIX fcntl locks, extensive unit test.Todd Gamblin1-83/+84
- llnl.util.lock now uses fcntl.lockf instead of flock - purported to have more NFS compatibility. - Added an extensive test case for locks. - tests acquiring, releasing, upgrading, timeouts, shared, & exclusive cases.
2015-09-17Simplify lock context managers.Todd Gamblin1-9/+21
2015-09-17Several changes to DB implementation.Todd Gamblin1-10/+17
1. Database stores a file version, so we can add to it in the future. 2. Database indexed by hashes and not numerical indexes. 3. Specs built by database have consistent hashes and it's checked. 4. minor naming and whitespace changes.
2015-08-31Fixed several issues from code reviewGregory Becker1-0/+136
Most importantly wrote the Lock, Read_Lock_Instance, and Write_Lock_Instance classes in lock.py Updated the locking in database.py TODO: Lock on larger areas