Package a Python Computation Graph
A Python-authored computation graph packages and deploys exactly like a Python
workflow: a package.toml plus a module tree under workflow/. The server loads
it through the same path as a Rust-authored graph. This how-to packages the
market_maker graph end to end. (For the workflow analog, see
Packaging Python Workflows.)
- A Python computation graph (see Python CG Decorator Surface).
cloacinactlinstalled, and a running server to upload to.
market-maker/
├── package.toml
└── workflow/
└── market_maker/
├── __init__.py
└── graph.py # @cloaca.reactor + ComputationGraphBuilder + @cloaca.node
The module tree must live under workflow/. graph.py holds the reactor,
the accumulators, the ComputationGraphBuilder, and the @cloaca.node functions
(see the Topology Dict Schema).
A computation-graph package sets graph_name (this is what marks it a CG rather
than a workflow) and entry_module (the dotted path, relative to workflow/,
the loader imports):
[package]
name = "market-maker"
version = "0.1.0"
interface = "cloacina-workflow-plugin"
interface_version = 1
extension = "cloacina"
[metadata]
language = "python"
graph_name = "market_maker"
entry_module = "market_maker.graph"
reaction_mode = "when_any" # or "when_all"
input_strategy = "latest" # or "sequential"
requires_python = ">=3.10"
Both are optional (defaults: reaction_mode = "when_any", input_strategy = "latest"):
reaction_modeshould match themode=on your@cloaca.reactor(when_any= fire when any accumulator has new data;when_all= wait for all).input_strategycontrols how queued boundaries are consumed:latestcollapses to the newest boundary (one execution on the most recent data);sequentialruns the graph once per boundary in order.
Importing entry_module runs your decorators, which register the graph.
cloacinactl package validate market-maker
cloacinactl package pack market-maker --out market-maker-0.1.0.cloacina
validate checks the layout and the closed [metadata] schema; pack writes
the .cloacina archive. (No maturin/compile step — a Python package ships
source.)
cloacinactl --tenant my_tenant package upload market-maker-0.1.0.cloacina
cloacinactl --tenant my_tenant graph list
Once the server loads it, the graph appears in graph list and its health is
queryable via cloacinactl graph status market_maker.
- Topology Dict Schema
- Packaging Python Workflows — the same packaging model for workflows.
- Package Format — the
.cloacinaarchive structure.