availability
availability
¶
Instrument availability checks.
Checks whether a named instrument is available for execution.
Used by:
- mzt doctor — instrument health checks
- mzt validate — warn on unavailable instruments
- Baton dispatch path — pre-flight before execution
The check is simple: 1. Is the instrument registered in the registry? 2. If it's a CLI instrument, is the binary on PATH? 3. If it's a CLI instrument, does it have a command configured?
Non-CLI instruments (http, native) are assumed available if registered, with
one exception (GH #437): an HTTP profile on a loopback host that ANSWERS a
model listing but does not serve the profile's default_model is
unavailable, with the served models in the reason. A loopback server that
does not answer at all stays "available" here — reachability is V215's
domain, and a test that registers a fake loopback profile must not pay for a
network round trip.
probe_profile is the ONE probe behind every command that answers "can
this instrument run here" (GH #447: doctor, instruments list,
instruments check, instruments classes check|write used to answer
it five ways). Its four states have one definition each:
ready: can run now — CLI binary on PATH, or a loopback server that serves the profile's model, or a native instrument.unavailable: cannot run — binary missing, declared unsupported, no command, or the loopback server answers but does not serve the model.unreachable: a loopback server that does not answer.unchecked: a remote HTTP endpoint; never probed (needs credentials).
check_profile_available keeps its (bool, reason) contract on top of
it: only unavailable is False, so validate and dispatch are unchanged.
Classes¶
ProfileProbe
dataclass
¶
What one instrument profile can do on this machine, right now.
Attributes¶
served_context
class-attribute
instance-attribute
¶
The context size a loopback server reports for its loaded model
(default_generation_settings.n_ctx on GET /props, which llama-server
and PolyStrata share), or None when the server does not expose it.
context_mismatch
class-attribute
instance-attribute
¶
Set when the profile's context_window for the default model exceeds
served_context: the executor would ask for more than the server has and
the first request would be refused with HTTP 400 (GH #494).
Functions:¶
check_instrument_available
¶
Check whether an instrument is available for execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The instrument name to check. |
required |
registry
|
InstrumentRegistry
|
The instrument registry to look up profiles. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
A |
str
|
When unavailable, reason describes why (for diagnostics/logging). |
Source code in src/marianne/instruments/availability.py
check_profile_available
¶
Apply the same local availability probe when the profile is already loaded.
Source code in src/marianne/instruments/availability.py
probe_profile
¶
The one availability probe every command consumes (GH #447).
Source code in src/marianne/instruments/availability.py
served_local_context
¶
The loaded model's context size a loopback server reports on GET /props
(default_generation_settings.n_ctx: llama-server and PolyStrata agree on
that path), or None when the server is remote, silent, keyed, or does not
expose it. A 0 (PolyStrata before its engine reports READY) is None too.
Source code in src/marianne/instruments/availability.py
served_local_models
¶
The model ids a loopback OpenAI-compatible server lists, or None if it does not answer (unreachable, non-JSON, or not loopback).