The Pattern in Python¶
from typing import Callable
import e2c
Configuration via DSL¶
The configuration determines the data flow.
config = (
'.run -- action',
'action.render -- render',
'action.store -- store')
Actors¶
Each function represents an actor.
def action(data, render, store):
render(data)
print('%s in action' % data)
store(1, data)
def render(data:str):
print('%s in render' % data)
def store(id: int, data:str):
print('%s and %d in store' % (data, id))
Graph¶
graph = e2c.Graph(config)
graph.actor('action', action)
graph.actor('render', render)
graph.actor('store', store)
Visualize¶
graph.visualize()