Skip to main content

Module node

Module node 

Source
Expand description

/weirdnet-backends/node/1: how inference nodes drive model nodes over weirdnet-net.

A model node pushes a Capability record to every subscriber: signed by the node’s key, chained to the user by its NodeCert, with a sequence number and a 90 second expiry, refreshed every 15 seconds and on every change. It takes Commands: Load, Unload, Drain, Reserve/Release (hold the node’s GPU for one job: nothing is placed there until released; nodes before 0.4.3 fail these calls), GroupUp/GroupDown and Health.

Fencing (since 0.4.11): a placement lease holder sends LoadFenced/UnloadFenced with its lease name and term (Fence). The node checks them against its FenceGuard before it loads or unloads anything and refuses an older term than it has seen for that lease (FenceRefusal::Stale, a Refused error). Unfenced Load/Unload work as before unless the node requires a fence (NodeService::with_fence_required). Nodes before 0.4.11 fail fenced commands (they close the stream) and leave fencing out of their records. Inference itself is raw infer/2 framing through ModelHost, served next to node/1 by NodeServer on RAW_INFER_PROTOCOL (/weirdnet-backends/infer/1) and, unless NodeServerOptions::legacy_infer2 is off, on /weirdnet-agent/infer/2 as in 0.1.0. Inference nodes dial model nodes through RawInferDialer, which prefers the new id.

Each stream carries one ClientMsg (CBOR, with the caller’s certificate) and its answers (ServerMsg); a Subscribe stream stays open for records until either side closes it or the node withdraws. Which nodes may drive a model node is the Authorize hook’s decision (weirdnet_agent::serve::RosterAuth admits the user’s linked devices).

Swap groups that span machines (a Ray worker or an rpc-server bound to a private link) are started by the application’s GroupWorkers; without one, a node answers GroupUp with Unsupported and says group_jobs: false in its record.

Re-exports§

pub use crate::fence::Fence;
pub use crate::fence::FenceGuard;
pub use crate::fence::FenceRefusal;
pub use crate::fence::Stale;
pub use crate::link::AddrClass;
pub use crate::link::LinkInfo;
pub use crate::link::LinkMeasure;

Structs§

Capability
What a model node can do right now.
ClientMsg
What a client sends: its certificate and one command.
GroupPlan
A swap group spanning machines, as the coordinator planned it.
Health
A health report.
Load
The node’s load.
ModelEntry
One model in a Capability record.
ModelHealth
NodeClient
An inference node’s side of node/1: drives model nodes over a Dialer (weirdnet_agent::pool::NetDialer on Weirdnet).
NodeServer
Serves a NodeService on a weirdnet-net node: node/1, raw inference through the service’s ModelHost on RAW_INFER_PROTOCOL (and infer/2, see NodeServerOptions; no catalog, no inference announcement) and the MODEL_NODE_APP announcement, which lists the protocols served. Dropping it stops serving.
NodeServerOptions
How a NodeServer serves raw inference.
NodeService
A model node’s node/1 side: issues records and runs commands against its ModelHost. Transport-neutral (NodeService::serve takes a channel); NodeServer runs it on a weirdnet-net node.
SignedRecord
A capability record with its signature and certificate.
Subscription
Verified records from one model node.
Verifier
Checks records against the user: valid signature, and a valid, unexpired certificate from the user for the very node that signed. With with_roster the node must also be linked in the roster now, so a revoked node presenting its old certificate is refused.

Enums§

Command
A node/1 request.
ServerMsg
What a model node answers.
Update
An update on a Subscription.

Constants§

MODEL_NODE_APP
The app name model nodes announce (Node::serve_app), so inference nodes find them among the user’s linked devices.
PROTOCOL
The protocol id.
RECORD_TTL
How long a record is good for.
REFRESH
How often a subscriber gets a fresh record when nothing changed.

Traits§

GroupWorkers
Starts and stops the processes of a cross-machine swap group (a Ray worker, an rpc-server). The application provides it; this crate has no such adapters.