mstar.engine.resources.spec#
Resource declarations models hand to the engine.
The engine builds each node’s resources once, at load time, from these specs. A spec names what to build and its parameters; the model declares, the engine constructs. The default declaration wraps a model’s KV cache configs unchanged, so a model only overrides it to add resources beyond what those configs already describe.
Functions
|
Apply a deployment's |
|
Index specs by resource key, checking uniqueness and |
|
Every duplicate resource key and undeclared |
|
Classes
|
A combined walk run on two kernels: decode for one-token rows, prefill for the rows of |
|
|
Per-request parameters for one resource, carried on the request and handed to that resource at ingest. |
- class mstar.engine.resources.spec.CombinedSplit(combined_walk, prefill_walks)[source]#
Bases:
objectA combined walk run on two kernels: decode for one-token rows, prefill for the rows of
prefill_walks, captured for as many asmax_rows_in_combinedlets in (an uncapped walk: the bucket’s rows).
- class mstar.engine.resources.spec.NodeResourceSpec(resource_key: str, nodes: set[str])[source]#
Bases:
ABC- apply_yaml_overrides(**kwargs)[source]#
Patch declared parameters from this resource’s YAML block.
The model declares shapes that suit the model; a deployment tunes what suits the box it runs on. The block is scoped to this spec’s
resource_key(seeapply_yaml_overridesbelow), so an unrecognized key here is a typo, not another resource’s setting — subclasses name exactly what they accept and let the rest raise.TODO: generalize. Matching YAML keys against the spec’s (and its config’s) dataclass fields would remove these per-resource implementations, at the cost of silently accepting anything named alike.
- depends_on()[source]#
Keys whose specs this one builds against; the engine resolves them into
EngineResourceInfo.dependencies.
- class mstar.engine.resources.spec.ResourceReqConfig[source]#
Bases:
objectPer-request parameters for one resource, carried on the request and handed to that resource at ingest. Keyed by resource key, so it needs no tag of its own — a marker base, with no contract beyond the hooks below.
- loop_room(spec=None)[source]#
The most iterations each loop can run before the request outgrows the resource built from
spec. A loop the resource doesn’t bound is left out.- Parameters:
spec (NodeResourceSpec | None)
- Return type:
- validate(spec=None)[source]#
Raise
ValueErrorif a client-supplied value is out of range, or one the resource built fromspeccannot honour.The conductor calls it at admission, so a bad request is a 400 before any worker sees it.
- Parameters:
spec (NodeResourceSpec | None)
- Return type:
None
- mstar.engine.resources.spec.apply_yaml_overrides(specs, model_config)[source]#
Apply a deployment’s
resources:block to the specs it names.resources: {<resource_key>: {...}}, one block per resource, so a model with two pools of the same kind (whisper’s decoder cache and its encoder context) can have each tuned on its own. An unknown key is an error: it would otherwise be a silently ineffective setting.- Parameters:
specs (Sequence[NodeResourceSpec])
- Return type:
None
- mstar.engine.resources.spec.resolve_spec_dependencies(specs)[source]#
Index specs by resource key, checking uniqueness and
depends_on.- Parameters:
specs (Sequence[NodeResourceSpec])
- Return type:
- mstar.engine.resources.spec.spec_dependency_problems(specs)[source]#
Every duplicate resource key and undeclared
depends_oninspecs.- Parameters:
specs (Sequence[NodeResourceSpec])
- Return type: