-
Notifications
You must be signed in to change notification settings - Fork 0
(WIP) Removing graph edge causes disconnection in underlying model #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
in analogy to the modification for `add_edge`. I'm not clear on the role or side effects of precluding edges involving at least one virtual node.
Graph operations are supposed to (and certainly in this case do) copy the graph, and the graph copy contains a node copy, so our original reference is out of date.
This appears to be very necessary, and makes me suspicious of add_edge
to be more explicit
This IS NOT FULLY WORKING. Removing the edge doesn't stop the underlying connection. For now encode the failure and keep moving.
This works ok when disconnecting edges in a flat graph, or between a node and a group when the group is the upstream partner, but when the group is the downstream partner it still never actually disconnects the underlying node. This is evidenced by the last two assertions in 3712983 I'm running out of time to actually solve this today, so I want to document my current best guess of where the problem is:
I believe this bug is a symptom of the complexity that comes with maintaining two separate workflow representations in Tests so far do not cover any cases where a group is in the |
|
I don't recommend going this route. It can't be done naively, because otherwise we would have users sitting in the GUI, disconnecting a node, and suddenly and unexpectedly having their expanded node collapse on them. So at a minimum, we need to check on disconnect whether the collapse is needed, log whether the collapse has been done, and then reverse it at the end. Overall, I still have a poor grasp of the side effects of the I actually already tried locally to follow my attack pattern outlined above -- copy-pasting
Quite possibly. I haven't dug into how you implemented the "self" connection yet, and so to avoid introducing new bugs I'm not aware of, I just fail hard on this branch. Overall, I'm trying to introduce symmetries, invariances, and transitivities to the model -- pyiron_core/pyiron_core/pyiron_workflow/graph/base.py Lines 370 to 379 in 65089ff
Here, calling |
I fully support your approach of introducing symmetries, invariances, and transitivities to these operations. It nicely aligns with what I did for the GUI interface, which calls for these operations and expects symmetries, etc. It will also be beneficial to incorporate them into the unit tests. This will allow us to later test more robust schemes and approaches that incorporate these principles directly. |
I still haven't figured this out, but I made some progress. The problem doesn't come from simply adding and removing the edge, but only if you perform other operations while the edge is there: from pyiron_core.pyiron_workflow.graph import (
base,
edges,
group,
run,
)
g = base.Graph(label="virtual_target")
g = base.add_node(g, base.identity(label="n1", x=0))
g = base.add_node(g, base.identity(label="n2"))
g = base.add_node(g, base.identity(label="n3"))
g = base.add_edge(g, "n2", "n3", "x", "x")
g = group.create_group(g, ["n2", "n3"], label="group")
virtual_edge = edges.GraphEdge("n1", "va_i_group__n2__x", "x", "x")
g = base.add_edge(
g,
virtual_edge.source,
virtual_edge.target,
virtual_edge.sourceHandle,
virtual_edge.targetHandle,
)
# intermediate = base.get_updated_graph(g) # Causes later pull to return None
# run.pull_node(intermediate, "group") # Causes later pull to return 0
g = base.remove_edge(g, virtual_edge)
gu = base.get_updated_graph(g)
assert(len(gu.edges) == 0)
try:
out = run.pull_node(gu, "group")
print(f"Run ought to crash, but instead got: {out}")
except ValueError as e:
assert("Input data missing" in str(e))
print("This is what we want -- with no edge, running should fail") So something in these two operations is impacting the graph and/or underlying workflow model(s) more deeply than the copying in |
Closes #45