diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2019-12-16 17:37:47 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2019-12-18 16:07:28 -0800 |
commit | f73cdac731a0f5955c1843535b21ce1101d897c3 (patch) | |
tree | 89f6a993e7bfc374691161eb73b9688345674aa6 /lib | |
parent | 33335c9d0a4a64bb59a169795ef1afed2c8aa0ac (diff) | |
download | spack-f73cdac731a0f5955c1843535b21ce1101d897c3.tar.gz spack-f73cdac731a0f5955c1843535b21ce1101d897c3.tar.bz2 spack-f73cdac731a0f5955c1843535b21ce1101d897c3.tar.xz spack-f73cdac731a0f5955c1843535b21ce1101d897c3.zip |
concretization: improve performance by avoiding database locks
Checks for deprecated specs were repeatedly taking out read locks on the
database, which can be very slow.
- [x] put a read transaction around the deprecation check
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/spec.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index c51f463850..64d8ecc0b3 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -2243,10 +2243,12 @@ class Spec(object): # If any spec in the DAG is deprecated, throw an error deprecated = [] - for x in self.traverse(): - _, rec = spack.store.db.query_by_spec_hash(x.dag_hash()) - if rec and rec.deprecated_for: - deprecated.append(rec) + with spack.store.db.read_transaction(): + for x in self.traverse(): + _, rec = spack.store.db.query_by_spec_hash(x.dag_hash()) + if rec and rec.deprecated_for: + deprecated.append(rec) + if deprecated: msg = "\n The following specs have been deprecated" msg += " in favor of specs with the hashes shown:\n" |