Documentation
¶
Overview ¶
Package rungraph shells out to render/comfy-run-graph.mjs — the generic "run an arbitrary ComfyUI graph + satisfy its node manifest" runner — through the same gpugen exec lifecycle imagegen uses (process-tree-kill, timeout, defer free-VRAM). The harness is 100% generic here: it passes the graph + manifest opaquely and reads back a node-addressed output envelope; it never interprets graph semantics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QueryTemplate ¶ added in v0.206.0
func QueryTemplate(ctx context.Context, node, script, comfyDir string, args []string, timeout time.Duration) ([]byte, error)
QueryTemplate runs `node <script> <args...> --comfy-dir <comfyDir>` and returns its stdout. A non-zero exit is an error that carries the script's own message (its stderr), because that message is what names the mistake (an unknown verb, a snapshot that is not one, a tree with no templates package). The child is hidden (winexec) and stops with ctx or at the deadline.
func TemplateScript ¶ added in v0.206.0
TemplateScript returns the path of render/run-template.mjs given the configured run-graph runner (run_graph_script): the file of that name in the same directory. A box with no run-graph route has no template tool to speak of.
Types ¶
type Envelope ¶
type Envelope struct {
Outputs map[string][]OutFile `json:"outputs"`
ImagePath string `json:"image_path"`
UnverifiedModels []string `json:"unverified_models"`
// TofuFirstSeen names the model files a template run recorded for the first time (trust on first use). Absent on a graph run.
TofuFirstSeen []string `json:"tofu_first_seen,omitempty"`
// Warnings carries what the satisfy let through but the caller should see (venv conflicts that predate the run, a
// coherence check that could not start on a proven-satisfied set). Absent when there is none.
Warnings []string `json:"warnings,omitempty"`
// Typed DEFER (fix #4): the mjs now exits 0 and writes {deferred,code,ref,detail} to the
// result on any handled failure, so the code reaches the Go side as data (not a lost
// stderr line). runRunGraph turns Deferred==true into a pipeline defer carrying Code+Detail.
Deferred bool `json:"deferred"`
Code string `json:"code"`
Ref string `json:"ref"`
Detail string `json:"detail"`
}
func Run ¶
func Run(ctx context.Context, node, script, comfyDir string, p Params, timeout time.Duration, samp *gpugen.Sampling, extraEnv ...string) (Envelope, error)
Run executes the graph and returns the parsed output envelope. samp, when non-nil, turns on gpugen's passive per-render VRAM peak sampling (fleet footprints; nil = legacy path). A non-zero exit / timeout / missing result file surfaces as an error the caller maps to a DEFER.
type Params ¶
type Params struct {
GraphPath, ManifestPath, OutDir, ResultPath, ReserveVram string
// Template names a workflow template of the node's installed templates package in place of a graph file: the runner converts it
// once ComfyUI is up (render/comfy-run-graph.mjs --template). OverridesPath is a JSON file of node-addressed input values to
// set after the conversion and Seed a whole number that pins its seed inputs; both belong to a template run.
Template, OverridesPath, Seed string
}