Please refer to online docs.
A simple math calculation
from node_graph import task
@task()
def add(x, y):
return x + y
@task()
def multiply(x, y):
return x * y
@task.graph()
def AddMultiply(x, y, z):
the_sum = add(x=x, y=y).result
return multiply(x=the_sum, y=z).resultExplore different execution engines in node-graph-engine.
Run the above graph locally with the LocalEngine and export the provenance graph:
from node_graph.engine.local import LocalEngine
graph = AddMultiply.build(x=1, y=2, z=3)
engine = LocalEngine()
results = engine.run(graph)
# export provenance for visualization
engine.recorder.save_graphviz_svg("add_multiply.svg")