add hash field to spec on find --json and assert in test its there (#26443)
Co-authored-by: Daniel Travieso <daniel@dgtravieso.com>
This commit is contained in:
parent
449a5832c8
commit
10de12c7d0
@ -259,17 +259,19 @@ def display_specs_as_json(specs, deps=False):
|
||||
seen = set()
|
||||
records = []
|
||||
for spec in specs:
|
||||
if spec.dag_hash() in seen:
|
||||
dag_hash = spec.dag_hash()
|
||||
if dag_hash in seen:
|
||||
continue
|
||||
seen.add(spec.dag_hash())
|
||||
records.append(spec.to_node_dict())
|
||||
records.append(spec.node_dict_with_hashes())
|
||||
seen.add(dag_hash)
|
||||
|
||||
if deps:
|
||||
for dep in spec.traverse():
|
||||
if dep.dag_hash() in seen:
|
||||
dep_dag_hash = dep.dag_hash()
|
||||
if dep_dag_hash in seen:
|
||||
continue
|
||||
seen.add(dep.dag_hash())
|
||||
records.append(dep.to_node_dict())
|
||||
records.append(dep.node_dict_with_hashes())
|
||||
seen.add(dep_dag_hash)
|
||||
|
||||
sjson.dump(records, sys.stdout)
|
||||
|
||||
|
@ -128,6 +128,7 @@ def test_namespaces_shown_correctly(database):
|
||||
def _check_json_output(spec_list):
|
||||
assert len(spec_list) == 3
|
||||
assert all(spec["name"] == "mpileaks" for spec in spec_list)
|
||||
assert all(spec["hash"] for spec in spec_list)
|
||||
|
||||
deps = [spec["dependencies"] for spec in spec_list]
|
||||
assert sum(["zmpi" in [node["name"] for d in deps for node in d]]) == 1
|
||||
|
Loading…
Reference in New Issue
Block a user