Guides¶
Welcome to the yieldgraph guides. These pages walk you through building pipelines — from a simple two-step chain all the way to multi-branch, threaded production pipelines.
-
Getting Started
Install yieldgraph and build your first pipeline in minutes. Covers sources, transforms, output, and the tuple data model.
-
Patterns & Recipes
Fan-out branches,
attach_to, error handling, cooperative cancellation, progress monitoring, and threaded execution. -
Configuration
Environment variables, log levels, the
LoggingBehaviormixin, and theENV/LOGconstants objects.
Quick reference¶
from yieldgraph import Graph
# Define steps
def source(graph):
for x in range(1, 6):
yield x
def square(x):
yield x ** 2
# Build
g = Graph()
g.add_chain(source, square)
# Run
g.run()
# Consume
print(g.output)
# [(1,), (4,), (9,), (16,), (25,)]
| Task | How |
|---|---|
| Build a linear pipeline | g.add_chain(fn1, fn2, fn3) |
| Branch from a node | g.add_chain(fn, attach_to="node_name") |
| Run sequentially | g.run() |
| Run with threads | YIELDGRAPH_THREADED=1 python ... |
| Check success | g.succeeded |
| Get errors | node.errors for each node |
| Cancel early | graph.cancelled = True inside a node |
Or from Python:
Cancellation¶
Set graph.cancelled = True at any point (e.g. from a signal handler or UI
callback) and all nodes will stop after their current yield.
Accessing results¶
After run() completes: