8000 changed _graph_checksums to a dict instead of a list · nipype/pydra@4e1d4a8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4e1d4a8

Browse files
committed
changed _graph_checksums to a dict instead of a list
1 parent 8a5541c commit 4e1d4a8

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

pydra/engine/core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,9 @@ def checksum_states(self, state_index=None):
281281
282282
"""
283283
if is_workflow(self) and self.inputs._graph_checksums is attr.NOTHING:
284-
self.inputs._graph_checksums = [
285-
(nd.name, nd.checksum) for nd in self.graph_sorted
286-
]
284+
self.inputs._graph_checksums = {
285+
nd.name: nd.checksum for nd in self.graph_sorted
286+
}
287287

288288
if state_index is not None:
289289
inputs_copy = copy(self.inputs)
@@ -1142,9 +1142,9 @@ def checksum(self):
11421142
"""
11431143
# if checksum is called before run the _graph_checksums is not ready
11441144
if is_workflow(self) and self.inputs._graph_checksums is attr.NOTHING:
1145-
self.inputs._graph_checksums = [
1146-
(nd.name, nd.checksum) for nd in self.graph_sorted
1147-
]
1145+
self.inputs._graph_checksums = {
1146+
nd.name: nd.checksum for nd in self.graph_sorted
1147+
}
11481148

11491149
input_hash = self.inputs.hash
11501150
if not self.state:

pydra/engine/submitter.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,17 @@ async def expand_workflow(self, wf, rerun=False):
184184
]
185185
for t in graph_copy.sorted_nodes
186186
}
187-
graph_checksums = dict(wf.inputs._graph_checksums)
188187

189188
hashes_have_changed = False
190189
for task, waiting_on in outstanding.items():
191190
if not waiting_on:
192191
continue
193192
msg += f"- '{task.name}' node blocked due to\n"
194193
for pred in waiting_on:
195-
if pred.checksum != graph_checksums[pred.name]:
194+
if (
195+
pred.checksum
196+
!= wf.inputs._graph_checksums[pred.name]
197+
):
196198
msg += (
197199
f" - hash changes in '{pred.name}' node inputs. "
198200
f"Current values and hashes: {pred.inputs}, "

0 commit comments

Comments
 (0)
0