summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/environment/environment.py2
-rw-r--r--lib/spack/spack/monitor.py11
-rw-r--r--lib/spack/spack/spec.py9
-rw-r--r--lib/spack/spack/test/monitor.py9
4 files changed, 17 insertions, 14 deletions
diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py
index d17a0afb58..75c99a9c21 100644
--- a/lib/spack/spack/environment/environment.py
+++ b/lib/spack/spack/environment/environment.py
@@ -1269,7 +1269,7 @@ class Environment(object):
by_hash = {}
for abstract, concrete in zip(root_specs, concretized_root_specs):
self._add_concrete_spec(abstract, concrete)
- by_hash[concrete.build_hash()] = concrete
+ by_hash[concrete.dag_hash()] = concrete
# Unify the specs objects, so we get correct references to all parents
self._read_lockfile_dict(self._to_lockfile_dict())
diff --git a/lib/spack/spack/monitor.py b/lib/spack/spack/monitor.py
index 85ffc3aa2e..cbaec20a48 100644
--- a/lib/spack/spack/monitor.py
+++ b/lib/spack/spack/monitor.py
@@ -132,7 +132,7 @@ class SpackMonitorClient:
self.tags = tags
self.save_local = save_local
- # We keey lookup of build_id by dag_hash
+ # We key lookup of build_id by dag_hash
self.build_ids = {}
self.setup_save()
@@ -412,7 +412,9 @@ class SpackMonitorClient:
spec.concretize()
# Remove extra level of nesting
- as_dict = {"spec": spec.to_dict(hash=ht.dag_hash)['spec'],
+ # This is the only place in Spack we still use full_hash, as `spack monitor`
+ # requires specs with full_hash-keyed dependencies.
+ as_dict = {"spec": spec.to_dict(hash=ht.full_hash)['spec'],
"spack_version": self.spack_version}
if self.save_local:
@@ -437,8 +439,7 @@ class SpackMonitorClient:
meta = spec.to_dict()['spec']
nodes = []
for node in meta.get("nodes", []):
- for hashtype in ["hash", "runtime_hash"]:
- node[hashtype] = "FAILED_CONCRETIZATION"
+ node["full_hash"] = "FAILED_CONCRETIZATION"
nodes.append(node)
meta['nodes'] = nodes
@@ -476,7 +477,7 @@ class SpackMonitorClient:
# Prepare build environment data (including spack version)
data = self.build_environment.copy()
- data['hash'] = dag_hash
+ data['full_hash'] = dag_hash
# If the build should be tagged, add it
if self.tags:
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 4e5226b0d6..3d3e23e253 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -2056,14 +2056,15 @@ class Spec(object):
# to be included. This is effectively the last chance we get to compute
# it accurately.
if self.concrete:
+ # all specs have at least a DAG hash
node[ht.dag_hash.name] = self.dag_hash()
+
else:
node['concrete'] = False
- if hash.name == 'process_hash':
- node[hash.name] = self.process_hash()
- elif hash.name == 'runtime_hash':
- node[hash.name] = self.runtime_hash()
+ # we can also give them other hash types if we want
+ if hash.name != ht.dag_hash.name:
+ node[hash.name] = self._cached_hash(hash)
return node
diff --git a/lib/spack/spack/test/monitor.py b/lib/spack/spack/test/monitor.py
index 74a57ec898..db313e0921 100644
--- a/lib/spack/spack/test/monitor.py
+++ b/lib/spack/spack/test/monitor.py
@@ -48,8 +48,10 @@ def mock_monitor_request(monkeypatch):
"""
def mock_do_request(self, endpoint, *args, **kwargs):
+ # monitor was originally keyed by full_hash, but now dag_hash is the full hash.
+ # the name of the field in monitor is still spec_full_hash, for now.
build = {"build_id": 1,
- "spec_hash": "bpfvysmqndtmods4rmy6d6cfquwblngp",
+ "spec_full_hash": "bpfvysmqndtmods4rmy6d6cfquwblngp",
"spec_name": "dttop"}
# Service Info
@@ -111,7 +113,7 @@ def mock_monitor_request(monkeypatch):
elif endpoint == "specs/new/":
return {"message": "success",
"data": {
- "hash": "bpfvysmqndtmods4rmy6d6cfquwblngp",
+ "full_hash": "bpfvysmqndtmods4rmy6d6cfquwblngp",
"name": "dttop",
"version": "1.0",
"spack_version": "0.16.0-1379-7a5351d495",
@@ -264,12 +266,11 @@ def test_install_monitor_save_local(install_mockery_mutable_config,
# Get the spec name
spec = spack.spec.Spec("dttop")
spec.concretize()
- dag_hash = spec.dag_hash()
# Ensure we have monitor results saved
for dirname in os.listdir(str(reports_dir)):
dated_dir = os.path.join(str(reports_dir), dirname)
- build_metadata = "build-metadata-%s.json" % dag_hash
+ build_metadata = "build-metadata-%s.json" % spec.dag_hash()
assert build_metadata in os.listdir(dated_dir)
spec_file = "spec-dttop-%s-config.json" % spec.version
assert spec_file in os.listdir(dated_dir)