Server & Lifecycle

The top-level entry points for starting and stopping a worker, plus the bundle registration hook called from a model's model.jl.

ReactantServer.serveFunction
serve(node_path; worker=nothing, backend=ReactantBackend(), blocking=true) -> nothing | RunningServer

Load the node config at node_path, resolve this process's worker, bring up the runtime and its assigned models, and start the gRPC control plane. worker selects which worker entry to serve; it may be omitted when the node has exactly one worker. When blocking is false the server runs in the background and a RunningServer is returned (stop it with stop!).

ReactantServer.serve_workerFunction
serve_worker(node_path, worker; backend=ReactantBackend(), blocking=true)

Convenience alias for serve that names the worker positionally.

ReactantServer.stop!Function
stop!(s::RunningServer)

Shut down a server started with serve(...; blocking=false). Stops the model-directory watcher (if running), closes the metrics endpoint (if running) and the gRPC server, halts the scheduler's dispatch loop, and tears down any registered shared-memory regions. Returns nothing.

ReactantServer.register_modelFunction
register_model(name; preprocess=identity, postprocess=identity)

Called from a bundle's model.jl to register custom pre/post-processing. Both hooks receive and return a Vector{NamedTensor}. Omitted hooks default to identity.

ReactantServer.register_meta_modelFunction
register_meta_model(name; run)

Called from a meta bundle's model.jl to register the orchestration function. run has the form run(inputs::Vector{NamedTensor}, call) -> Vector{NamedTensor}, where call(model_name, inputs) invokes another model. The meta runs as a scheduled unit holding the GPU exclusively, and call invokes the sub-model's compiled executable directly in-process (no queue re-entry, no gateway hop).

ReactantServer.RunningServerType
RunningServer

Handle to a server started with serve(...; blocking=false). It holds the resolved ServerConfig, the model registry, the running Scheduler, the device memory pool, the shared-memory registry, the underlying gRPC server, and the listen port. Pass it to stop! to shut the server down.

Node supervisor

ReactantServerNode.supervise is the container entry point: it detects the visible GPUs, spawns one serve worker subprocess per device, multiplexes the children's output with [name] line prefixes, and restarts them on failure. With two or more workers it also runs the embedded gateway; with a single worker it binds that worker to the public ports directly and runs no gateway. See Docker Deployment for the operational surface.

ReactantServerNode.superviseFunction
supervise(node_path; role=nothing, gateway_path=nothing, sink=stdout, env=ENV,
          install_signal_handlers=true, kwargs...) -> Int

Run the node: spawn one worker subprocess per visible GPU (and the embedded gateway in the default all-in-one role), multiplex their output onto sink with [name] line prefixes, restart children that die, and block until SIGTERM/SIGINT (or a crash-loop budget breach). Returns the process exit code.