Workflow¶
Fluent DAG builder. Every wf.<type>(...) call creates a Node, registers
it on the workflow, and returns the Node for chaining with >>.
A workflow is serialized to the backend's workflow_data shape via
to_workflow_data() and executed remotely via deploy() /
deploy_and_run() (both call the deployed nexus-backend over HTTP).
add_node ¶
Generic escape hatch when no typed helper exists for a node type. Prefer the typed helpers (wf.postgres, wf.ai_tagging, ...) when available.
validate ¶
Dry-run structural checks on the workflow.
Returns a list of human-readable error messages. An empty list means the workflow looks structurally valid; deploying it may still fail server-side validation (connection strings, credentials, etc.) but the shape is consistent.
Checks performed
- No node has an empty name or duplicate name.
- Every edge references a node that belongs to this workflow.
- At least one terminal (no outgoing edge) node exists.
- No cycles in the DAG.
- Unknown nodes referenced in an
expr.node('Name')expression inside any node's configuration surface as warnings.
visualize ¶
Render the DAG as a string.
fmt="mermaid" (default) produces a flowchart LR block that
renders natively in GitHub Markdown and Jupyter notebooks.
fmt="ascii" produces a simple a -> b edge listing for terminals
and quick diffs.
to_json ¶
Serialize the workflow to a JSON string.
Round-trips with Workflow.from_json(). Useful for version control,
diffing, and cross-language export.
to_yaml ¶
Serialize the workflow to YAML.
Requires the [yaml] extra: pip install athena-sdk[yaml].
from_workflow_data
classmethod
¶
Reconstruct a Workflow from a workflow_data dict.
Inverse of :meth:to_workflow_data. Node objects are re-created by name
and wired via the same connection list — back-end-assigned node ids do
not survive the round trip (they are regenerated on the next deploy).
from_json
classmethod
¶
Parse a JSON string produced by :meth:to_json back into a Workflow.
from_yaml
classmethod
¶
Parse a YAML string produced by :meth:to_yaml back into a Workflow.
Requires the [yaml] extra.
deploy_and_run ¶
Deploy to a hosted nexus-backend + trigger + block until complete.