Skip to content

Commit 8966979

Browse files
committed
Don't overwite goofi patches if the saving process had issues
1 parent 8a421ae commit 8966979

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/goofi/manager.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,12 @@ def save(self, filepath: Optional[str] = None, overwrite: bool = False, timeout:
530530
for node in serialized_nodes.values():
531531
node.pop("out_conns")
532532

533+
# make sure the number of serialized nodes is correct
534+
if len(serialized_nodes) != len(self.nodes):
535+
filepath = f"{filepath}.incomplete"
536+
# TODO: add proper logging
537+
print(f"WARNING: Mismatch between serialized nodes and actual nodes, saving may be incomplete. Saving to '{filepath}'.")
538+
533539
# convert the manager instance into yaml format
534540
manager_yaml = yaml.dump({"nodes": serialized_nodes, "links": links})
535541

0 commit comments

Comments
 (0)