Closed superstar54 closed 3 months ago
from aiida_workgraph import WorkGraph, task from aiida import load_profile load_profile() @task.calcfunction() def add(x, y): return x +y @task.calcfunction(inputs=[{"name": "data", "link_limit": 1000}]) def sum(**data): return sum(data.values()) wg = WorkGraph() sum1 = wg.add_task(sum, name="sum1") # sum1.inputs["data"].link_limit = 2 wg.add_task(add, name="add1", x=1, y=2) wg.add_task(add, name="add2", x=3, y=4) wg.add_link(wg.tasks["add1"].outputs["result"], wg.tasks["sum1"].inputs["data"]) wg.add_link(wg.tasks["add2"].outputs["result"], wg.tasks["sum1"].inputs["data"]) wg.run() print("result: ", sum1.outputs["result"].value)
This will raise an error that the data socket already exists.
data
This will raise an error that the
data
socket already exists.