Skip to content

Commit

Permalink
Add some checks for qgraph metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
eigerx committed Sep 18, 2024
1 parent b612d20 commit 1e0d6d1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions python/lsst/pipe/base/quantum_provenance_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,14 +980,19 @@ def assemble_quantum_provenance_graph(
curse_failed_logs: bool = False,
) -> None:
output_runs = []
for count, qgraph in enumerate(qgraphs):
if not isinstance(qgraph, QuantumGraph):
qgraph = QuantumGraph.loadUri(qgraph)
for count, graph in enumerate(qgraphs):
qgraph = graph if isinstance(graph, QuantumGraph) else QuantumGraph.loadUri(graph)
assert qgraph.metadata is not None, "Saved QGs always have metadata."
# If the most recent graph's timestamp was earlier than any of the
# previous graphs, raise a RuntimeError.
if len(qgraphs) > 1:
for graph in qgraphs[: count - 1]:
if qgraph.metadata["time"] < graph.metadata["time"]:
for previous_graph in qgraphs[: count - 1]:
previous_graph = (

Check warning on line 990 in python/lsst/pipe/base/quantum_provenance_graph.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/pipe/base/quantum_provenance_graph.py#L990

Added line #L990 was not covered by tests
previous_graph
if isinstance(previous_graph, QuantumGraph)
else QuantumGraph.loadUri(previous_graph)
)
if qgraph.metadata["time"] < previous_graph.metadata["time"]:
raise RuntimeError(

Check warning on line 996 in python/lsst/pipe/base/quantum_provenance_graph.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/pipe/base/quantum_provenance_graph.py#L996

Added line #L996 was not covered by tests
"""add_new_graph may only be called on graphs
which are passed in the order they were
Expand Down

0 comments on commit 1e0d6d1

Please sign in to comment.