-
Notifications
You must be signed in to change notification settings - Fork 5
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
Change of syntax WorkGraph.add_link
#176
Comments
Thanks for the suggestions. Since we need both the names of the task and the socket (port), I assume you mean: WorkGraph.add_link(input= "add1.result", output="multiply1.x") Or more simple: WorkGraph.add_link("add1.result", "multiply1.x") Or more intuitively: WorkGraph.add_link(from_task= "add1", from_socket="result", to_task="multiply1", to_socket="x") In principle, we can provide these options to simplify the syntax; which one do you suggest? |
Just a note here that the wg.add_link(add_task.outputs["result"], multiply_task.inputs["x"]) given that both tasks were previously added to the wg = WorkGraph()
add_task = wg.add_task(add, name="add1", x=<foo>)
multiply_task = wg.add_task(multiply, name="multiply1")
wg.add_link(add_task.outputs["result"], multiply_task.inputs["x"]) Though, it would be nice to have tab completion. This works for Now, regarding @superstar54's response: From our discussion this morning, it seems like overall, we would like to move away from the use of these magic strings, so I would vouch against the provided options, as users don't know what is possible. If the identifiers are still attached to the instances, it's at least easier to inspect them. Also, I just saw that internally And lastly, I'm not sure about the third option. The PS: add_task = wg.add_task(add, name="add1", x=<foo>)
multiply_task = wg.add_task(multiply, name="multiply1")
wg.add_link(add_task.outputs["result"], multiply_task.inputs["x"]) and add_task = wg.add_task(add, name="add1", x=<foo>)
multiply_task = wg.add_task(multiply, name="multiply1", x=add_task.outputs["result"]) I suppose not, they should behave exactly the same? I think it's nice that |
After discussing with @GeigerJ2 actually what I propose is to use and advertise the standard object approach, like this: This way you have: WorkGraph.add_link(source= add_1.output['result'], target=multiply_1.input['x'])
and /or
WorkGraph.add_link(source= add_1.result, target=multiply_1.x) |
I found this syntax a bit difficult to digests:
Since input and output are the primary keywords for
add_link
, how about a syntax like this:Intuitively every link is from output of a node to input of another node.
The text was updated successfully, but these errors were encountered: