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
This commit is contained in:
parent
48befd67b5
commit
cbf8553406
1 changed files with 6 additions and 4 deletions
|
@ -2243,10 +2243,12 @@ def concretize(self, tests=False):
|
||||||
|
|
||||||
# If any spec in the DAG is deprecated, throw an error
|
# If any spec in the DAG is deprecated, throw an error
|
||||||
deprecated = []
|
deprecated = []
|
||||||
|
with spack.store.db.read_transaction():
|
||||||
for x in self.traverse():
|
for x in self.traverse():
|
||||||
_, rec = spack.store.db.query_by_spec_hash(x.dag_hash())
|
_, rec = spack.store.db.query_by_spec_hash(x.dag_hash())
|
||||||
if rec and rec.deprecated_for:
|
if rec and rec.deprecated_for:
|
||||||
deprecated.append(rec)
|
deprecated.append(rec)
|
||||||
|
|
||||||
if deprecated:
|
if deprecated:
|
||||||
msg = "\n The following specs have been deprecated"
|
msg = "\n The following specs have been deprecated"
|
||||||
msg += " in favor of specs with the hashes shown:\n"
|
msg += " in favor of specs with the hashes shown:\n"
|
||||||
|
|
Loading…
Reference in a new issue