From 4e1d4a89f40857453ac8cb86f1061426a8ebcb3e Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sat, 24 Feb 2024 22:52:10 +1100 Subject: [PATCH] changed _graph_checksums to a dict instead of a list --- pydra/engine/core.py | 12 ++++++------ pydra/engine/submitter.py | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pydra/engine/core.py b/pydra/engine/core.py index 4143b10175..a523c24525 100644 --- a/pydra/engine/core.py +++ b/pydra/engine/core.py @@ -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) @@ -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: diff --git a/pydra/engine/submitter.py b/pydra/engine/submitter.py index 9eea2a2c75..6effed2538 100644 --- a/pydra/engine/submitter.py +++ b/pydra/engine/submitter.py @@ -184,7 +184,6 @@ 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(): @@ -192,7 +191,10 @@ async def expand_workflow(self, wf, rerun=False): continue 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}, "