Skip to content

Commit

Permalink
Check for list index before comparing to previous element in pipetask…
Browse files Browse the repository at this point in the history
… report cli
  • Loading branch information
eigerx committed Oct 7, 2024
1 parent 8a8e908 commit 22702c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions doc/changes/DM-46689.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Compare timestamps properly between two graphs when using pipetask report on multiple graphs.

(The bug was looping back to say the "previous" graph was the end of the list when "count" was 0). Also fix the wording in the associated RuntimeError.
6 changes: 3 additions & 3 deletions python/lsst/ctrl/mpexec/cli/script/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ def report_v2(
for count, qgraph in enumerate(qgraphs):
if len(qgraphs) > 1:
previous_graph = qgraphs[count - 1]
if qgraph.metadata["time"] < previous_graph.metadata["time"]:
if count > 0 and qgraph.metadata["time"] < previous_graph.metadata["time"]:
raise RuntimeError(
f"""add_new_graph may only be called on graphs
which are passed in the order they were
created. Please call again, passing your
graphs in order. Time of first graph:
graphs in order. Time of second graph:
{qgraph.metadata["time"]} >
time of second graph: {previous_graph.metadata["time"]}"""
time of first graph: {previous_graph.metadata["time"]}"""
)
qpg.assemble_quantum_provenance_graph(butler, qgraphs, collections, where, curse_failed_logs)
summary = qpg.to_summary(butler, do_store_logs=logs)
Expand Down

0 comments on commit 22702c2

Please sign in to comment.