Documentation
¶
Overview ¶
Package modeldprobe detects whether the modeld daemon (the separate CGO inference binary) is installed, running, or dead, so the runtime can fail honestly and the setup wizard can guide the user.
It is pure Go and self-contained: it locates the binary and inspects the owner lease via liblease. It deliberately does not import modeld — the only shared facts are the lease file name and the endpoint metadata key, mirrored here as constants (see cmd/modeld and modeld/owner.EndpointMetaKey).
Detect() reports lease-based liveness, a network-free proxy: a wedged process can still hold a fresh lease. Probe() adds the real reachability ping over the runtime's gRPC transport — it confirms the lease holder actually answers and is the instance serving the endpoint, downgrading a wedged owner to unreachable. Probe imports the runtime transport client (not modeld). See docs/blueprints/modeld-provisioning-detection.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotInstalled = errors.New("modeld is not installed") ErrNotRunning = errors.New("modeld is not running") ErrStale = errors.New("modeld owner is stale (the daemon may have crashed)") ErrUnreachable = errors.New("modeld holds a lease but does not answer a health probe") )
Typed, actionable errors. Status.Err returns one of these (or nil) so callers can branch with errors.Is.
Functions ¶
func DefaultDataRoot ¶
func DefaultDataRoot() string
DefaultDataRoot resolves the contenox data root: $CONTENOX_DATA_ROOT, else ~/.contenox.
Types ¶
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
Detector resolves the modeld state. Construct it with New; the now and lookPath fields are injectable for tests.
func New ¶
New returns a Detector for the given data root (where the owner lease lives). An empty dataRoot falls back to DefaultDataRoot.
func (*Detector) Detect ¶
Detect resolves the current modeld state. A live lease takes precedence (the daemon is running regardless of whether we can locate the binary locally, e.g. when an extension started it from its own directory); binary presence then distinguishes stale/not-running from not-installed.
func (*Detector) Probe ¶ added in v0.32.3
Probe resolves the state and, when a fresh lease names a live owner, confirms the owner actually answers a health ping on its advertised endpoint. A lease is only a liveness proxy; this downgrades a wedged owner (fresh lease, dead transport) or a stale/mismatched endpoint from running to unreachable. Pass a ctx with a deadline — the ping dials the network. Detect() remains the cheap, network-free check for callers that only need lease state.
type State ¶
type State int
State is the detected condition of the modeld daemon.
const ( // StateNotInstalled means no modeld binary could be located. StateNotInstalled State = iota // StateNotRunning means the binary exists but no owner lease is present. StateNotRunning // StateStale means an owner lease exists but has expired: the daemon // likely crashed or was killed. StateStale // StateRunning means a live owner holds a fresh lease. StateRunning // StateUnreachable means a fresh lease names a live owner, but its advertised // endpoint does not answer a health probe: the daemon is wedged, still // bringing up its transport, or the advertised endpoint is wrong. Only Probe // (not Detect) can report this, because it requires a network round-trip. StateUnreachable )
type Status ¶
type Status struct {
State State
Binary string // resolved binary path, when located
Endpoint string // advertised IPC endpoint, when running
Instance string // owner instance UUID, when a lease is present
Backend string // inference backend the owner serves ("llama"/"openvino"/"none"), when running
}
Status is the result of a detection.