Skip to content

Commit

Permalink
changed _graph_checksums to a dict instead of a list
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Feb 24, 2024
1 parent 8a5541c commit 4e1d4a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 6 additions & 6 deletions pydra/engine/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ def checksum_states(self, state_index=None):
"""
if is_workflow(self) and self.inputs._graph_checksums is attr.NOTHING:
self.inputs._graph_checksums = [
(nd.name, nd.checksum) for nd in self.graph_sorted
]
self.inputs._graph_checksums = {
nd.name: nd.checksum for nd in self.graph_sorted
}

if state_index is not None:
inputs_copy = copy(self.inputs)
Expand Down Expand Up @@ -1142,9 +1142,9 @@ def checksum(self):
"""
# if checksum is called before run the _graph_checksums is not ready
if is_workflow(self) and self.inputs._graph_checksums is attr.NOTHING:
self.inputs._graph_checksums = [
(nd.name, nd.checksum) for nd in self.graph_sorted
]
self.inputs._graph_checksums = {
nd.name: nd.checksum for nd in self.graph_sorted
}

input_hash = self.inputs.hash
if not self.state:
Expand Down
6 changes: 4 additions & 2 deletions pydra/engine/submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,17 @@ async def expand_workflow(self, wf, rerun=False):
]
for t in graph_copy.sorted_nodes
}
graph_checksums = dict(wf.inputs._graph_checksums)

hashes_have_changed = False
for task, waiting_on in outstanding.items():
if not waiting_on:
continue

Check warning on line 191 in pydra/engine/submitter.py

View check run for this annotation

Codecov / codecov/patch

pydra/engine/submitter.py#L191

Added line #L191 was not covered by tests
msg += f"- '{task.name}' node blocked due to\n"
for pred in waiting_on:
if pred.checksum != graph_checksums[pred.name]:
if (
pred.checksum
!= wf.inputs._graph_checksums[pred.name]
):
msg += (
f" - hash changes in '{pred.name}' node inputs. "
f"Current values and hashes: {pred.inputs}, "
Expand Down

0 comments on commit 4e1d4a8

Please sign in to comment.