ProtocolDAG dag order and key are stable on roundtrip from one process to another
Current Behavior
When playing around with random graphs, I stumbled upon some odd behaviour.
There are some very special hard-to-reproduce cases when the ProtocolDAG key is unstable due to different ordering of protocol_units in nx.topological_sort on different hardware architectures or even different processes. This is related to an old networkx issue: https://github.com/networkx/networkx/issues/1181
Expected Behavior
ProtocolDAG
dag order and key are stable on roundtrip from one process to anotherCurrent Behavior
When playing around with random graphs, I stumbled upon some odd behaviour.
There are some very special hard-to-reproduce cases when the
ProtocolDAG
key is unstable due to different ordering of protocol_units innx.topological_sort
on different hardware architectures or even different processes. This is related to an old networkx issue: https://github.com/networkx/networkx/issues/1181Steps to Reproduce
test.json
Outputs:
Context (Environment)
python: 3.10 gufe: 1.0.0 networkx: 3.2.1
Possible Implementation
Either use
OrderedDiGraph
from networkx which guarantees consistent ordering or additionally sortProtocolUnit
s lexicographicallyFrom
https://github.com/OpenFreeEnergy/gufe/blob/2425b4cf7c08047dc27b559b0e5729215f05f002/gufe/protocols/protocoldag.py#L47-L49
To: d95fa5d9eb85e0e7c95a6f02fef30011b6b4a4c4