@simplexai/localmodels-win32-x64 0.1.0-dev.63 → 0.1.0-dev.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bootstrap.identity +1 -1
- package/bootstrap.sha256 +140 -130
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/__main__.py +2 -2
- package/modules/localmodels/app.py +15 -2
- package/modules/localmodels/approval.py +5 -3
- package/modules/localmodels/bifrost_checks.py +2 -1
- package/modules/localmodels/catalog.json +36 -0
- package/modules/localmodels/catalog.py +28 -5
- package/modules/localmodels/catalog_recipes.py +40 -1
- package/modules/localmodels/component.py +1 -1
- package/modules/localmodels/context_policy.py +7 -2
- package/modules/localmodels/custom_probe.py +5 -5
- package/modules/localmodels/debug_mode.py +85 -103
- package/modules/localmodels/deploy.py +129 -18
- package/modules/localmodels/deployment_lifecycle.py +167 -0
- package/modules/localmodels/download-mirrors.json +126 -6
- package/modules/localmodels/draft_spec.py +164 -0
- package/modules/localmodels/engine_adapters/__init__.py +4 -0
- package/modules/localmodels/engine_adapters/auxiliary.py +27 -0
- package/modules/localmodels/engine_adapters/base.py +40 -0
- package/modules/localmodels/engine_adapters/strata_poly.py +57 -0
- package/modules/localmodels/engine_adapters/suite_plan.py +394 -0
- package/modules/localmodels/engines-prism-b12178-03ec600.json +7 -7
- package/modules/localmodels/gateway.py +124 -13
- package/modules/localmodels/gateway_accept.py +1 -6
- package/modules/localmodels/gateway_cli.py +13 -24
- package/modules/localmodels/gateway_ops.py +185 -0
- package/modules/localmodels/gateway_server.py +3 -2
- package/modules/localmodels/harness.py +13 -16
- package/modules/localmodels/harness_core.py +4 -9
- package/modules/localmodels/harness_gateway.py +4 -3
- package/modules/localmodels/hosts.py +22 -34
- package/modules/localmodels/install.py +15 -0
- package/modules/localmodels/library_convert.py +5 -11
- package/modules/localmodels/library_custom.py +6 -6
- package/modules/localmodels/library_elastic.py +24 -127
- package/modules/localmodels/library_jobs.py +14 -5
- package/modules/localmodels/library_order.py +4 -3
- package/modules/localmodels/library_poly.py +5 -4
- package/modules/localmodels/library_pricing.py +80 -255
- package/modules/localmodels/library_serve.py +13 -14
- package/modules/localmodels/library_smoke.py +8 -1
- package/modules/localmodels/library_status.py +16 -16
- package/modules/localmodels/llm_rank.py +1 -1
- package/modules/localmodels/magpie_legacy.py +160 -0
- package/modules/localmodels/magpie_setup.py +6 -1
- package/modules/localmodels/memcalc_cli.py +2 -2
- package/modules/localmodels/pi_profile.py +3 -7
- package/modules/localmodels/plan_envelope.py +1 -1
- package/modules/localmodels/planning/__init__.py +3 -0
- package/modules/localmodels/{budget.py → planning/budget.py} +48 -30
- package/modules/localmodels/{stack_llm_ram.py → planning/llm_ram.py} +11 -1
- package/modules/localmodels/{memcalc_load.py → planning/memcalc_load.py} +1 -1
- package/modules/localmodels/planning/memory_pools.py +403 -0
- package/modules/localmodels/{sizecalc.py → planning/sizecalc.py} +1 -1
- package/modules/localmodels/recommend.py +1 -1
- package/modules/localmodels/recommend_cli.py +3 -4
- package/modules/localmodels/residency_host.py +1 -1
- package/modules/localmodels/service_control.py +4 -4
- package/modules/localmodels/service_deployment.py +3 -2
- package/modules/localmodels/service_wiring.py +17 -19
- package/modules/localmodels/setup_inspection.py +1 -1
- package/modules/localmodels/setup_inspection_harness.py +1 -1
- package/modules/localmodels/setup_upgrade.py +3 -12
- package/modules/localmodels/sizecalc_cli.py +10 -2
- package/modules/localmodels/speech_admission.py +1 -1
- package/modules/localmodels/speech_jobs.py +2 -1
- package/modules/localmodels/speech_model.py +2 -0
- package/modules/localmodels/speech_server.py +130 -9
- package/modules/localmodels/speech_state.py +11 -0
- package/modules/localmodels/speech_worker_sensevoice.py +38 -0
- package/modules/localmodels/speech_workers.py +5 -1
- package/modules/localmodels/stack.py +4 -9
- package/modules/localmodels/stack_arena.py +2 -2
- package/modules/localmodels/stack_auto.py +5 -5
- package/modules/localmodels/stack_aux_gpu.py +5 -3
- package/modules/localmodels/stack_binding.py +24 -143
- package/modules/localmodels/stack_capacity.py +1 -1
- package/modules/localmodels/stack_card.py +3 -3
- package/modules/localmodels/stack_cleanup.py +6 -5
- package/modules/localmodels/stack_client_settings.py +9 -2
- package/modules/localmodels/stack_compose.py +43 -6
- package/modules/localmodels/stack_console.py +2 -2
- package/modules/localmodels/stack_debug.py +1 -1
- package/modules/localmodels/stack_decision.py +1 -1
- package/modules/localmodels/stack_doctor.py +10 -7
- package/modules/localmodels/stack_down.py +3 -3
- package/modules/localmodels/stack_gpu_memory.py +1 -1
- package/modules/localmodels/stack_hardware.py +3 -3
- package/modules/localmodels/stack_hardware_text.py +1 -1
- package/modules/localmodels/stack_ledger.py +2 -1
- package/modules/localmodels/stack_lifecycle.py +7 -7
- package/modules/localmodels/stack_mcp.py +1 -1
- package/modules/localmodels/stack_memory.py +4 -4
- package/modules/localmodels/stack_mlx.py +1 -1
- package/modules/localmodels/stack_plan.py +18 -13
- package/modules/localmodels/stack_ports.py +2 -2
- package/modules/localmodels/stack_preflight.py +4 -3
- package/modules/localmodels/stack_remove.py +13 -6
- package/modules/localmodels/stack_review.py +3 -5
- package/modules/localmodels/stack_rollback.py +1 -1
- package/modules/localmodels/stack_route.py +5 -4
- package/modules/localmodels/stack_run.py +16 -0
- package/modules/localmodels/stack_suite.py +14 -6
- package/modules/localmodels/stack_summary.py +1 -1
- package/modules/localmodels/stack_try.py +10 -14
- package/modules/localmodels/stack_up.py +25 -39
- package/modules/localmodels/stack_update.py +2 -1
- package/modules/localmodels/stack_verify.py +4 -30
- package/modules/localmodels/stack_view.py +6 -4
- package/modules/localmodels/stack_view_apply.py +2 -2
- package/modules/localmodels/stack_view_llm.py +12 -7
- package/modules/localmodels/stack_view_text.py +2 -6
- package/modules/localmodels/stack_view_tick.py +2 -2
- package/modules/localmodels/stack_view_words.py +5 -2
- package/modules/localmodels/stack_warm.py +7 -4
- package/modules/localmodels/stack_whatif.py +1 -1
- package/modules/localmodels/suite.py +6 -334
- package/modules/localmodels/tui_views.py +28 -7
- package/modules/localmodels/web/index.html +595 -226
- package/modules/localmodels/web/sizecalc/app.js +34 -40
- package/modules/localmodels/web/sizecalc/calc.js +3 -3
- package/modules/localmodels/web/sizecalc/page.html +4 -3
- package/modules/localmodels/web/view/fleet.html +18 -3
- package/modules/localmodels/web/view/fleet.js +135 -14
- package/modules/localmodels/web/view/i18n.js +4 -0
- package/modules/localmodels/web/view/index.html +16 -0
- package/modules/localmodels/web/view/nav.js +49 -0
- package/modules/localmodels/web/view/theme.js +1 -1
- package/modules/localmodels/web/view/view.css +51 -15
- package/modules/localmodels/web/view/view.js +22 -4
- package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev65.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev65.dist-info}/RECORD +137 -127
- package/package.json +1 -1
- package/tool.json +1 -1
- package/modules/localmodels/library_vram.py +0 -123
- /package/modules/localmodels/{memcalc.py → planning/memcalc.py} +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev65.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev65.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev65.dist-info}/licenses/NOTICE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev63.dist-info → simplex_localmodels-0.1.0.dev65.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -14,54 +14,48 @@ from __future__ import annotations
|
|
|
14
14
|
|
|
15
15
|
import copy
|
|
16
16
|
import functools
|
|
17
|
-
import os
|
|
18
17
|
import shutil
|
|
19
18
|
from collections.abc import Iterable, Mapping
|
|
20
19
|
from dataclasses import dataclass
|
|
21
20
|
from pathlib import Path
|
|
22
|
-
from typing import
|
|
21
|
+
from typing import Literal
|
|
23
22
|
|
|
23
|
+
from localmodels import catalog as cat
|
|
24
24
|
from localmodels import (
|
|
25
|
-
budget,
|
|
26
25
|
context_policy,
|
|
26
|
+
debug_mode,
|
|
27
27
|
deploy,
|
|
28
28
|
engines,
|
|
29
29
|
hosts,
|
|
30
30
|
library_kept,
|
|
31
31
|
library_poly,
|
|
32
|
-
library_vram,
|
|
33
32
|
llm_rank,
|
|
34
33
|
metal,
|
|
35
34
|
plan_envelope,
|
|
35
|
+
remote_ops_download,
|
|
36
|
+
stack_compose,
|
|
36
37
|
stack_hardware,
|
|
37
|
-
stack_llm_ram,
|
|
38
38
|
suite,
|
|
39
39
|
vision,
|
|
40
40
|
)
|
|
41
|
-
from localmodels import catalog as cat
|
|
42
41
|
from localmodels.context_policy import AgentPosture
|
|
43
42
|
from localmodels.estimator import (
|
|
44
43
|
AGENT_VRAM_RESERVE_BYTES,
|
|
45
|
-
|
|
44
|
+
PhysicsRefusal,
|
|
46
45
|
agent_footprint_bytes,
|
|
47
46
|
eager,
|
|
48
47
|
)
|
|
49
48
|
from localmodels.library_model import LibraryError, Reason, display_name, split_id
|
|
49
|
+
from localmodels.planning import budget, llm_ram, memory_pools
|
|
50
50
|
from localmodels.probe import HostFacts
|
|
51
51
|
from localmodels.records import Plan
|
|
52
|
-
from localmodels.stack_plan import platform_error
|
|
53
|
-
|
|
54
|
-
POOL_RAM_FRACTION = 0.8 # a "system" pool's budget: RAM x 0.8 (contract v2)
|
|
55
|
-
UNIFIED_RESERVE_BYTES = metal.HOST_KEEP_BYTES + METAL_VRAM_RESERVE_BYTES
|
|
56
|
-
DESKTOP_VRAM_BASELINE_CAP_BYTES = budget.DESKTOP_VRAM_BASELINE_CAP_BYTES
|
|
52
|
+
from localmodels.stack_plan import default_options, platform_error
|
|
57
53
|
|
|
58
54
|
|
|
59
55
|
@functools.cache
|
|
60
56
|
def posture() -> AgentPosture:
|
|
61
57
|
"""The default stack plan's agent posture: its slots, image input and thinking cap."""
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return stack_compose.agent_posture(stack.default_options())
|
|
58
|
+
return stack_compose.agent_posture(default_options())
|
|
65
59
|
|
|
66
60
|
|
|
67
61
|
@dataclass(frozen=True)
|
|
@@ -134,214 +128,6 @@ def platform_problem(facts: HostFacts) -> str | None:
|
|
|
134
128
|
return platform_error(facts["platform"], arch=facts.get("arch"))
|
|
135
129
|
|
|
136
130
|
|
|
137
|
-
# ---------------------------------------------------------------------------- pools
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
def visible(facts: HostFacts) -> set[int] | None:
|
|
141
|
-
"""The NVIDIA cards ``CUDA_VISIBLE_DEVICES`` (indices or UUIDs) leaves to the library;
|
|
142
|
-
None when it is not set. The library never places a model on a card hidden from it."""
|
|
143
|
-
given = os.environ.get("CUDA_VISIBLE_DEVICES")
|
|
144
|
-
if given is None:
|
|
145
|
-
return None
|
|
146
|
-
names = {part.strip() for part in given.split(",") if part.strip()}
|
|
147
|
-
return {
|
|
148
|
-
g["index"]
|
|
149
|
-
for g in facts.get("gpus") or []
|
|
150
|
-
if str(g["index"]) in names or g["uuid"] in names
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def _cuda_uma(facts: HostFacts) -> int | None:
|
|
155
|
-
"""Allocator pool bytes for an NVIDIA unified-memory device (e.g. Grace/GB10), else None."""
|
|
156
|
-
if metal.supported(facts):
|
|
157
|
-
return None
|
|
158
|
-
return budget.unified_pool_bytes(facts)
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
def pools(facts: HostFacts) -> dict[str, str]:
|
|
162
|
-
"""Pool id -> the planner's placement id: one per discrete NVIDIA card (``gpu:N``),
|
|
163
|
-
Apple Silicon or CUDA unified memory (``unified``), and ``system`` for host RAM."""
|
|
164
|
-
found: dict[str, str] = {}
|
|
165
|
-
shown = visible(facts)
|
|
166
|
-
for p in budget.placements(facts, planning=True):
|
|
167
|
-
if p.pooled:
|
|
168
|
-
continue
|
|
169
|
-
if p.backend == "metal":
|
|
170
|
-
found["unified"] = p.id
|
|
171
|
-
elif p.backend == "cuda" and p.budget.uma:
|
|
172
|
-
if not p.gpu_indices or shown is None or p.gpu_indices[0] in shown:
|
|
173
|
-
found["unified"] = p.id
|
|
174
|
-
elif p.backend == "cuda" and not p.budget.uma and len(p.gpu_indices) == 1:
|
|
175
|
-
if shown is None or p.gpu_indices[0] in shown:
|
|
176
|
-
found[f"gpu:{p.gpu_indices[0]}"] = p.id
|
|
177
|
-
if "unified" not in found:
|
|
178
|
-
found["system"] = "cpu"
|
|
179
|
-
return found
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
def gpu_index(pool: str) -> int | None:
|
|
183
|
-
return int(pool.split(":", 1)[1]) if pool.startswith("gpu:") else None
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
def _cuda_uma_budget_bytes(base: int) -> int:
|
|
187
|
-
usable = int(base * (1 - budget._UMA_HEADROOM_FRACTION))
|
|
188
|
-
return max(0, usable - AGENT_VRAM_RESERVE_BYTES)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
def _cuda_uma_live(facts: HostFacts) -> tuple[int, int]:
|
|
192
|
-
"""(free_bytes, reserve_bytes) on a CUDA unified-memory pool."""
|
|
193
|
-
unified = _cuda_uma(facts) or facts["ram"]["total_bytes"]
|
|
194
|
-
nvidia = [
|
|
195
|
-
g
|
|
196
|
-
for g in facts.get("gpus") or []
|
|
197
|
-
if g.get("vendor") == "nvidia" and g.get("mig_mode") != "enabled"
|
|
198
|
-
]
|
|
199
|
-
first_free = nvidia[0]["free_bytes"] if nvidia else 0
|
|
200
|
-
_, ram_avail = budget.host_ram(facts)
|
|
201
|
-
free = _cuda_uma_budget_bytes(min(unified, first_free + ram_avail))
|
|
202
|
-
return free, max(0, unified - _cuda_uma_budget_bytes(unified))
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
def pool_total(facts: HostFacts, pool: str) -> int:
|
|
206
|
-
index = gpu_index(pool)
|
|
207
|
-
if index is not None:
|
|
208
|
-
return next(g["total_bytes"] for g in facts["gpus"] if g["index"] == index)
|
|
209
|
-
if pool == "unified":
|
|
210
|
-
if (unified := _cuda_uma(facts)) is not None:
|
|
211
|
-
return _cuda_uma_budget_bytes(unified)
|
|
212
|
-
return max(
|
|
213
|
-
0,
|
|
214
|
-
facts["ram"]["total_bytes"]
|
|
215
|
-
- (metal.soft_host_keep_bytes(facts) + METAL_VRAM_RESERVE_BYTES),
|
|
216
|
-
)
|
|
217
|
-
return int(facts["ram"]["total_bytes"] * POOL_RAM_FRACTION)
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
def _unified_live(facts: HostFacts) -> tuple[int, int]:
|
|
221
|
-
"""(free_bytes, reserve_bytes) on a unified pool (Metal soft budget or CUDA UMA)."""
|
|
222
|
-
if _cuda_uma(facts) is not None:
|
|
223
|
-
return _cuda_uma_live(facts)
|
|
224
|
-
adm = budget.admission_budget(facts, "unified")
|
|
225
|
-
base_reserve = metal.soft_host_keep_bytes(facts) + METAL_VRAM_RESERVE_BYTES
|
|
226
|
-
return (adm.soft_budget_bytes, adm.reserve_bytes) if adm is not None else (0, base_reserve)
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
def pool_free(facts: HostFacts, pool: str) -> int:
|
|
230
|
-
index = gpu_index(pool)
|
|
231
|
-
if index is not None:
|
|
232
|
-
return next(g["free_bytes"] for g in facts["gpus"] if g["index"] == index)
|
|
233
|
-
if pool == "unified":
|
|
234
|
-
return _unified_live(facts)[0]
|
|
235
|
-
used = facts["ram"]["total_bytes"] - facts["ram"]["available_bytes"]
|
|
236
|
-
return max(0, pool_total(facts, pool) - used)
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
def pool_reserve(facts: HostFacts, pool: str) -> int:
|
|
240
|
-
"""Memory kept back from models on ``pool`` for OS, display, or safety margins."""
|
|
241
|
-
if gpu_index(pool) is not None:
|
|
242
|
-
return AGENT_VRAM_RESERVE_BYTES
|
|
243
|
-
if pool == "unified":
|
|
244
|
-
return _unified_live(facts)[1]
|
|
245
|
-
return max(0, facts["ram"]["total_bytes"] - pool_total(facts, pool))
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
def pool_of(plan: Plan) -> str:
|
|
249
|
-
"""The pool a deployment plan runs in: its card, unified memory, else RAM."""
|
|
250
|
-
placement: dict[str, Any] = dict(plan.get("placement") or {})
|
|
251
|
-
gpus: list[dict[str, Any]] = list(placement.get("gpus") or [])
|
|
252
|
-
if placement.get("id") == "host" or (gpus and gpus[0].get("uuid") == metal.METAL_UUID):
|
|
253
|
-
return "unified"
|
|
254
|
-
if gpus:
|
|
255
|
-
return f"gpu:{gpus[0]['index']}"
|
|
256
|
-
return "system"
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
def capacity(facts: HostFacts, *, reclaimable: Mapping[str, int] | None = None) -> HostFacts:
|
|
260
|
-
"""``facts`` at loadable capacity once loaded library models are unloaded: keeps macOS's
|
|
261
|
-
idle baseline (``metal.in_use``) on Apple Silicon and observed desktop/WDDM baseline VRAM
|
|
262
|
-
on Windows and display-active GPUs instead of pretending zero OS/desktop overhead."""
|
|
263
|
-
seen = copy.deepcopy(facts)
|
|
264
|
-
for gpu in seen.get("gpus") or []:
|
|
265
|
-
free = library_vram.gpu_capacity_free(
|
|
266
|
-
facts, gpu, reclaimable, DESKTOP_VRAM_BASELINE_CAP_BYTES
|
|
267
|
-
)
|
|
268
|
-
gpu["free_bytes"], gpu["used_bytes"] = free, max(0, gpu["total_bytes"] - free)
|
|
269
|
-
ram = seen["ram"]
|
|
270
|
-
if metal.supported(seen):
|
|
271
|
-
total = ram["total_bytes"]
|
|
272
|
-
idle = max(0, total - metal.in_use(total))
|
|
273
|
-
ram["available_bytes"] = min(total, max(ram["available_bytes"], idle))
|
|
274
|
-
if ram.get("pressure_level") is not None:
|
|
275
|
-
ram["pressure_level"] = 1
|
|
276
|
-
ram.pop("pressure_kept_bytes", None)
|
|
277
|
-
else:
|
|
278
|
-
ram["available_bytes"] = ram["total_bytes"]
|
|
279
|
-
if cgroup := seen.get("cgroup_memory"):
|
|
280
|
-
cgroup["usage_bytes"] = 0
|
|
281
|
-
seen["llama_servers"] = []
|
|
282
|
-
seen["disk"] = {**seen["disk"], "free_bytes": None}
|
|
283
|
-
if services := seen.get("services"):
|
|
284
|
-
services["compute_processes"], services["containers"] = [], []
|
|
285
|
-
services["systemd_units"] = []
|
|
286
|
-
return seen
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
def live(
|
|
290
|
-
facts: HostFacts, reserved: dict[str, int], freed: dict[str, int] | None = None
|
|
291
|
-
) -> HostFacts:
|
|
292
|
-
"""``facts`` less what loading models reserved and plus what ``freed`` gives back, per pool;
|
|
293
|
-
ports and disk are left to the load (a download plan is not bound to them)."""
|
|
294
|
-
seen = copy.deepcopy(facts)
|
|
295
|
-
change = dict(reserved)
|
|
296
|
-
for pool, n in (freed or {}).items():
|
|
297
|
-
change[pool] = change.get(pool, 0) - n
|
|
298
|
-
for gpu in seen.get("gpus") or []:
|
|
299
|
-
delta = change.get(f"gpu:{gpu['index']}", 0)
|
|
300
|
-
gpu["free_bytes"] = max(0, min(gpu["total_bytes"], gpu["free_bytes"] - delta))
|
|
301
|
-
ram = seen["ram"]
|
|
302
|
-
unified_delta = change.get("unified", 0)
|
|
303
|
-
system_delta = change.get("system", 0)
|
|
304
|
-
if (unified := _cuda_uma(seen)) is not None and unified_delta:
|
|
305
|
-
nvidia = [
|
|
306
|
-
g
|
|
307
|
-
for g in seen.get("gpus") or []
|
|
308
|
-
if g.get("vendor") == "nvidia" and g.get("mig_mode") != "enabled"
|
|
309
|
-
]
|
|
310
|
-
first = nvidia[0] if nvidia else None
|
|
311
|
-
first_free = first["free_bytes"] if first is not None else 0
|
|
312
|
-
current_live = min(unified, first_free + ram["available_bytes"])
|
|
313
|
-
scaled = int(round(unified_delta / (1 - budget._UMA_HEADROOM_FRACTION)))
|
|
314
|
-
target = max(0, min(unified, current_live - scaled))
|
|
315
|
-
if first is not None and first_free > target:
|
|
316
|
-
first["free_bytes"], ram["available_bytes"] = target, 0
|
|
317
|
-
else:
|
|
318
|
-
ram["available_bytes"] = max(0, min(ram["total_bytes"], target - first_free))
|
|
319
|
-
if system_delta:
|
|
320
|
-
ram["available_bytes"] = max(
|
|
321
|
-
0, min(ram["total_bytes"], ram["available_bytes"] - system_delta)
|
|
322
|
-
)
|
|
323
|
-
else:
|
|
324
|
-
delta = unified_delta + system_delta
|
|
325
|
-
ram["available_bytes"] = max(0, min(ram["total_bytes"], ram["available_bytes"] - delta))
|
|
326
|
-
if metal.supported(seen) and unified_delta:
|
|
327
|
-
gpu_reading = metal.gpu_in_use_reading(seen)
|
|
328
|
-
metal_doc = seen.get("metal")
|
|
329
|
-
if isinstance(metal_doc, dict):
|
|
330
|
-
cur_in_use = metal.gpu_in_use_bytes(seen)
|
|
331
|
-
metal_doc["gpu_in_use_bytes"] = max(0, cur_in_use + unified_delta)
|
|
332
|
-
wired_ram = ram.get("wired_bytes")
|
|
333
|
-
if isinstance(wired_ram, int) and not isinstance(wired_ram, bool) and wired_ram >= 0:
|
|
334
|
-
wired_delta = (
|
|
335
|
-
max(unified_delta, -gpu_reading)
|
|
336
|
-
if unified_delta < 0 and gpu_reading is not None
|
|
337
|
-
else unified_delta
|
|
338
|
-
)
|
|
339
|
-
ram["wired_bytes"] = max(0, min(ram["total_bytes"], wired_ram + wired_delta))
|
|
340
|
-
seen["llama_servers"] = []
|
|
341
|
-
seen["disk"] = {**seen["disk"], "free_bytes": None}
|
|
342
|
-
return seen
|
|
343
|
-
|
|
344
|
-
|
|
345
131
|
# ---------------------------------------------------------------------------- pricing
|
|
346
132
|
|
|
347
133
|
|
|
@@ -356,13 +142,53 @@ def host_ram_bytes(plan: Plan, catalog: tuple[cat.CatalogEntry, ...]) -> int:
|
|
|
356
142
|
min_cache_bytes = (
|
|
357
143
|
(posture().prompt_cache_min_mib << 20) if posture().prompt_cache_mib > 0 else 0
|
|
358
144
|
)
|
|
359
|
-
return
|
|
145
|
+
return llm_ram.own_bytes(plan, catalog, running=False, metal=False) + min_cache_bytes
|
|
360
146
|
|
|
361
147
|
|
|
362
148
|
def _required_host_ram(plan: Plan, catalog: tuple[cat.CatalogEntry, ...]) -> int:
|
|
363
149
|
return host_ram_bytes(plan, catalog) + budget.HARNESS_RAM + budget.RAM_FLOOR
|
|
364
150
|
|
|
365
151
|
|
|
152
|
+
def validate_plan_bounds(
|
|
153
|
+
facts: HostFacts,
|
|
154
|
+
model: Model,
|
|
155
|
+
pool: str,
|
|
156
|
+
plan: Plan,
|
|
157
|
+
catalog: tuple[cat.CatalogEntry, ...],
|
|
158
|
+
*,
|
|
159
|
+
check_pool_total: bool = True,
|
|
160
|
+
check_host_ram: bool = True,
|
|
161
|
+
) -> None:
|
|
162
|
+
"""Reject a plan exceeding ``pool``'s total capacity or host RAM on a discrete GPU."""
|
|
163
|
+
if check_pool_total:
|
|
164
|
+
total = memory_pools.pool_total(facts, pool)
|
|
165
|
+
used = memory_pools.memory_bytes(plan)
|
|
166
|
+
if used > total:
|
|
167
|
+
refused = PhysicsRefusal(
|
|
168
|
+
needed_bytes=used,
|
|
169
|
+
available_bytes=total,
|
|
170
|
+
message=f"{model.id} needs {used} bytes, exceeding pool {pool} total {total} bytes",
|
|
171
|
+
)
|
|
172
|
+
raise deploy.AgentMemoryError(
|
|
173
|
+
refused.message,
|
|
174
|
+
refused,
|
|
175
|
+
"unified memory" if pool == "unified" else "GPU memory",
|
|
176
|
+
)
|
|
177
|
+
if check_host_ram and memory_pools.gpu_index(pool) is not None:
|
|
178
|
+
needed_ram = _required_host_ram(plan, catalog)
|
|
179
|
+
_, avail_ram = budget.host_ram(facts)
|
|
180
|
+
if needed_ram > avail_ram:
|
|
181
|
+
refused = PhysicsRefusal(
|
|
182
|
+
needed_bytes=needed_ram,
|
|
183
|
+
available_bytes=avail_ram,
|
|
184
|
+
message=(
|
|
185
|
+
f"{model.id} needs {needed_ram} bytes of system memory, "
|
|
186
|
+
f"exceeding {avail_ram} bytes available"
|
|
187
|
+
),
|
|
188
|
+
)
|
|
189
|
+
raise deploy.AgentMemoryError(refused.message, refused, "system memory")
|
|
190
|
+
|
|
191
|
+
|
|
366
192
|
def price(
|
|
367
193
|
facts: HostFacts,
|
|
368
194
|
model: Model,
|
|
@@ -374,9 +200,7 @@ def price(
|
|
|
374
200
|
require_live: bool = False,
|
|
375
201
|
) -> Plan:
|
|
376
202
|
"""The deployment plan on ``pool``; AgentMemoryError when it does not fit there."""
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
placement = pools(facts).get(pool)
|
|
203
|
+
placement = memory_pools.pools(facts).get(pool)
|
|
380
204
|
if placement is None:
|
|
381
205
|
raise plan_envelope.PlanError(f"this computer has no pool {pool}")
|
|
382
206
|
if library_kept.retired(model.entry):
|
|
@@ -390,7 +214,7 @@ def price(
|
|
|
390
214
|
raise LiveMemoryUnavailable(problem)
|
|
391
215
|
adm = budget.admission_budget(facts, "unified")
|
|
392
216
|
if adm is not None:
|
|
393
|
-
facts =
|
|
217
|
+
facts = memory_pools.facts_for_budget(
|
|
394
218
|
facts, "unified", adm.soft_budget_bytes, wired_cap_bytes=adm.wired_headroom_bytes
|
|
395
219
|
)
|
|
396
220
|
else:
|
|
@@ -414,16 +238,10 @@ def price(
|
|
|
414
238
|
entries=effective_catalog,
|
|
415
239
|
resolver=deploy.catalog_pins,
|
|
416
240
|
)
|
|
417
|
-
|
|
241
|
+
validate_plan_bounds(facts, model, pool, plan, effective_catalog)
|
|
418
242
|
return plan
|
|
419
243
|
|
|
420
244
|
|
|
421
|
-
def memory_bytes(plan: Plan) -> int:
|
|
422
|
-
launch = plan["launch"]
|
|
423
|
-
value = launch.get("unified_bytes") or launch.get("vram_bytes") or 0
|
|
424
|
-
return int(str(value))
|
|
425
|
-
|
|
426
|
-
|
|
427
245
|
@dataclass
|
|
428
246
|
class Priced:
|
|
429
247
|
"""A model against this computer: fit, the pool it would take, and its plan there."""
|
|
@@ -447,7 +265,7 @@ def _min_pool_need(model: Model, pool: str, exc: deploy.AgentMemoryError, facts:
|
|
|
447
265
|
to zero inside ``agent_budget`` or ``vision.priced``."""
|
|
448
266
|
if model.entry.runtime == "strata-poly":
|
|
449
267
|
return exc.needed_bytes
|
|
450
|
-
if gpu_index(pool) is not None:
|
|
268
|
+
if memory_pools.gpu_index(pool) is not None:
|
|
451
269
|
return exc.needed_bytes + AGENT_VRAM_RESERVE_BYTES
|
|
452
270
|
if pool == "unified" and metal.supported(facts):
|
|
453
271
|
profile = model.entry.profile(model.variant)
|
|
@@ -475,10 +293,10 @@ def _live_plan(
|
|
|
475
293
|
*,
|
|
476
294
|
fallback_need: int = 0,
|
|
477
295
|
) -> tuple[Plan | None, int, int]:
|
|
478
|
-
now = live(facts, reserved)
|
|
479
|
-
if pool not in pools(now):
|
|
296
|
+
now = memory_pools.live(facts, reserved)
|
|
297
|
+
if pool not in memory_pools.pools(now):
|
|
480
298
|
return None, max(fallback_need, 1), 0
|
|
481
|
-
free = pool_free(now, pool)
|
|
299
|
+
free = memory_pools.pool_free(now, pool)
|
|
482
300
|
try:
|
|
483
301
|
plan = price(now, model, pool, base_dir, catalog, require_live=True)
|
|
484
302
|
except deploy.AgentMemoryError as exc:
|
|
@@ -525,8 +343,11 @@ def judge(
|
|
|
525
343
|
reclaimable: Mapping[str, int] | None = None,
|
|
526
344
|
) -> Priced:
|
|
527
345
|
"""Fit on loadable capacity; pick the freest card that fits live, else capacity, else unified."""
|
|
528
|
-
cap, now =
|
|
529
|
-
|
|
346
|
+
cap, now = (
|
|
347
|
+
memory_pools.capacity(facts, reclaimable=reclaimable),
|
|
348
|
+
memory_pools.live(facts, reserved),
|
|
349
|
+
)
|
|
350
|
+
order = sorted(memory_pools.pools(facts), key=lambda p: -memory_pools.pool_free(now, p))
|
|
530
351
|
fallback: Priced | None = None
|
|
531
352
|
shortfall: tuple[int, int, str] | None = None
|
|
532
353
|
blocker: Reason | None = None
|
|
@@ -552,7 +373,13 @@ def judge(
|
|
|
552
373
|
continue
|
|
553
374
|
fit = "unified" if pool == "unified" else "gpu"
|
|
554
375
|
live_plan, load_need, load_free = _live_plan(
|
|
555
|
-
facts,
|
|
376
|
+
facts,
|
|
377
|
+
model,
|
|
378
|
+
pool,
|
|
379
|
+
base_dir,
|
|
380
|
+
catalog,
|
|
381
|
+
reserved,
|
|
382
|
+
fallback_need=memory_pools.memory_bytes(plan),
|
|
556
383
|
)
|
|
557
384
|
if live_plan is not None:
|
|
558
385
|
return Priced(fit, pool, live_plan, True, load_free_bytes=load_free)
|
|
@@ -567,7 +394,7 @@ def judge(
|
|
|
567
394
|
blocker is None
|
|
568
395
|
and memory_kind == "vram"
|
|
569
396
|
and need > have
|
|
570
|
-
and
|
|
397
|
+
and memory_pools.fits_idle_desktop(
|
|
571
398
|
facts, cap, order, lambda f, p: price(f, model, p, base_dir, catalog)
|
|
572
399
|
)
|
|
573
400
|
)
|
|
@@ -587,6 +414,8 @@ def judge(
|
|
|
587
414
|
|
|
588
415
|
def base_free(base_dir: str) -> int:
|
|
589
416
|
"""Free bytes on the filesystem that will hold ``<base_dir>/models``."""
|
|
417
|
+
if (simulated := debug_mode.simulating()) is not None:
|
|
418
|
+
return debug_mode.simulated_disk_free(simulated)
|
|
590
419
|
path = Path(base_dir).expanduser() / "models"
|
|
591
420
|
while not path.exists() and path != path.parent:
|
|
592
421
|
path = path.parent
|
|
@@ -598,8 +427,6 @@ def base_free(base_dir: str) -> int:
|
|
|
598
427
|
|
|
599
428
|
def missing_bytes(plan: Plan) -> int:
|
|
600
429
|
"""Bytes a download still has to fetch: files neither verified in place nor partly kept."""
|
|
601
|
-
from localmodels import remote_ops_download
|
|
602
|
-
|
|
603
430
|
left = 0
|
|
604
431
|
for f in plan["files"]:
|
|
605
432
|
if plan_envelope.verified_in_place(f):
|
|
@@ -614,9 +441,9 @@ def missing_bytes(plan: Plan) -> int:
|
|
|
614
441
|
|
|
615
442
|
|
|
616
443
|
def _gpu_unsupported_reason(facts: HostFacts) -> Reason | None:
|
|
617
|
-
if any(p != "system" for p in pools(facts)):
|
|
444
|
+
if any(p != "system" for p in memory_pools.pools(facts)):
|
|
618
445
|
return None
|
|
619
|
-
if visible(facts) == set() and any(
|
|
446
|
+
if memory_pools.visible(facts) == set() and any(
|
|
620
447
|
g.get("vendor") == "nvidia" for g in facts.get("gpus") or []
|
|
621
448
|
):
|
|
622
449
|
return None
|
|
@@ -661,7 +488,7 @@ def download_reason(facts: HostFacts, priced: Priced, disk_free: int) -> Reason
|
|
|
661
488
|
def _smartest_library_fallback(facts: HostFacts, base_dir: str) -> tuple[str, str] | None:
|
|
662
489
|
"""Best live-fitting llama.cpp library model ranked by ``llm_rank.choose()``."""
|
|
663
490
|
catalog = entries()
|
|
664
|
-
pool_map = pools(facts)
|
|
491
|
+
pool_map = memory_pools.pools(facts)
|
|
665
492
|
live_pools = [p for p in pool_map if p != "system"]
|
|
666
493
|
if not live_pools:
|
|
667
494
|
return None
|
|
@@ -688,7 +515,7 @@ def _smartest_library_fallback(facts: HostFacts, base_dir: str) -> tuple[str, st
|
|
|
688
515
|
)
|
|
689
516
|
is_fb = llm_rank.windows_fallback(model.entry, facts)
|
|
690
517
|
score = 0 if (is_fb or llm_rank.mac_rung(model.entry, facts)) else model.entry.quality
|
|
691
|
-
ranked.append(((score, tok_s), model.entry.id, gpu_index(pool) or 0))
|
|
518
|
+
ranked.append(((score, tok_s), model.entry.id, memory_pools.gpu_index(pool) or 0))
|
|
692
519
|
by_id[model.entry.id] = model
|
|
693
520
|
if is_fb:
|
|
694
521
|
fallback_ids.add(model.entry.id)
|
|
@@ -711,13 +538,11 @@ def _smartest_library_fallback(facts: HostFacts, base_dir: str) -> tuple[str, st
|
|
|
711
538
|
def smartest(facts: HostFacts, base_dir: str = deploy.DEFAULT_BASE_DIR) -> tuple[str, str] | None:
|
|
712
539
|
"""(catalog id, quant) of the smartest live library pick; falls back to library models when
|
|
713
540
|
``stack`` selects Strata/PolyStrata or on CUDA unified-memory hosts."""
|
|
714
|
-
from localmodels import stack
|
|
715
|
-
|
|
716
541
|
seen = copy.deepcopy(facts)
|
|
717
|
-
if (shown_cards := visible(facts)) is not None:
|
|
542
|
+
if (shown_cards := memory_pools.visible(facts)) is not None:
|
|
718
543
|
seen["gpus"] = [g for g in seen.get("gpus") or [] if g["index"] in shown_cards]
|
|
719
544
|
try:
|
|
720
|
-
view = stack_hardware.view(seen,
|
|
545
|
+
view = stack_hardware.view(seen, default_options(), posture())
|
|
721
546
|
except (KeyError, ValueError, TypeError, OSError):
|
|
722
547
|
return None
|
|
723
548
|
pick = next(
|
|
@@ -728,7 +553,7 @@ def smartest(facts: HostFacts, base_dir: str = deploy.DEFAULT_BASE_DIR) -> tuple
|
|
|
728
553
|
pick["id"] not in library_poly.strata_ids() or library_poly.in_library(pick["id"], seen)
|
|
729
554
|
):
|
|
730
555
|
return (pick["id"], pick["quant"])
|
|
731
|
-
if pick is not None or
|
|
556
|
+
if pick is not None or memory_pools.cuda_uma_bytes(seen) is not None:
|
|
732
557
|
return _smartest_library_fallback(seen, base_dir)
|
|
733
558
|
return None
|
|
734
559
|
|
|
@@ -773,7 +598,7 @@ def floor_metadata(
|
|
|
773
598
|
effective_shortfall = 0 if memory_kind == "ram" else shortfall_bytes
|
|
774
599
|
return max(effective_shortfall, floor_bytes), window, vision_on, download
|
|
775
600
|
metal_unified = metal.supported(facts)
|
|
776
|
-
cuda_uma =
|
|
601
|
+
cuda_uma = memory_pools.cuda_uma_bytes(facts) is not None
|
|
777
602
|
active = model.entry.agent_posture(
|
|
778
603
|
context_policy.posture_for(posture(), "metal" if metal_unified else "cuda")
|
|
779
604
|
)
|
|
@@ -21,11 +21,13 @@ from typing import cast
|
|
|
21
21
|
|
|
22
22
|
from localmodels import (
|
|
23
23
|
app,
|
|
24
|
+
debug_mode,
|
|
24
25
|
deploy,
|
|
25
26
|
engines,
|
|
26
27
|
frontend,
|
|
27
28
|
harness,
|
|
28
29
|
hosts,
|
|
30
|
+
library_convert,
|
|
29
31
|
library_elastic,
|
|
30
32
|
library_gateway,
|
|
31
33
|
library_jobs,
|
|
@@ -46,6 +48,7 @@ from localmodels.library_elastic import ElasticPlan, ElasticRoomError
|
|
|
46
48
|
from localmodels.library_model import LibraryError, LoadStep, Row, problem_from_error, progress
|
|
47
49
|
from localmodels.library_pricing import Model
|
|
48
50
|
from localmodels.library_state import Job, JobHandle, LoadPosture, PostureSnapshot, Record
|
|
51
|
+
from localmodels.planning import memory_pools
|
|
49
52
|
from localmodels.probe import HostFacts
|
|
50
53
|
from localmodels.records import FinishedRecord, Plan
|
|
51
54
|
from localmodels.transport import Executor
|
|
@@ -251,7 +254,7 @@ def _room(
|
|
|
251
254
|
ctx: int | None = None,
|
|
252
255
|
) -> ElasticPlan:
|
|
253
256
|
"""LOAD_NO_ROOM unless the model fits its pool under dual-tier admission after ``freed``."""
|
|
254
|
-
now =
|
|
257
|
+
now = memory_pools.live(facts, _reserved(model.id), freed)
|
|
255
258
|
use_jinja, _ = _custom_flags(record)
|
|
256
259
|
try:
|
|
257
260
|
return library_elastic.price_elastic(
|
|
@@ -272,7 +275,7 @@ def _room(
|
|
|
272
275
|
except engines.EngineUnavailableError as exc:
|
|
273
276
|
raise LibraryError("RUNTIME_DEPENDENCY_MISSING", str(exc)) from None
|
|
274
277
|
except plan_envelope.PlanError as exc: # its pool is gone, hidden, or under critical pressure
|
|
275
|
-
need = record.get("memory_bytes") or
|
|
278
|
+
need = record.get("memory_bytes") or memory_pools.memory_bytes(record["plan"])
|
|
276
279
|
raise LibraryError(
|
|
277
280
|
"LOAD_NO_ROOM", str(exc), pool=record["pool"], need_bytes=need, free_bytes=0
|
|
278
281
|
) from None
|
|
@@ -281,6 +284,8 @@ def _room(
|
|
|
281
284
|
def _port(facts: HostFacts) -> int:
|
|
282
285
|
"""Under ``locked()``: a free port that no recorded server and no live load holds; the
|
|
283
286
|
caller reserves it in its load job before releasing the lock."""
|
|
287
|
+
if debug_mode.simulating() is not None:
|
|
288
|
+
return debug_mode.simulated_port()
|
|
284
289
|
taken = [r["plan"]["service"]["port"] for r in library_state.records() if r["state"] != "idle"]
|
|
285
290
|
taken += [
|
|
286
291
|
job.get("port", 0)
|
|
@@ -397,7 +402,7 @@ def _serve_elastic_plan(
|
|
|
397
402
|
"""Price the elastic plan for ``_serve``, demoting GPU-resident speech first when tight."""
|
|
398
403
|
|
|
399
404
|
def price(seen: HostFacts) -> ElasticPlan:
|
|
400
|
-
now =
|
|
405
|
+
now = memory_pools.live(seen, _reserved(model.id))
|
|
401
406
|
return library_elastic.price_elastic(
|
|
402
407
|
now,
|
|
403
408
|
model,
|
|
@@ -428,7 +433,7 @@ def _serve_elastic_plan(
|
|
|
428
433
|
except engines.EngineUnavailableError as exc:
|
|
429
434
|
raise LibraryError("RUNTIME_DEPENDENCY_MISSING", str(exc), failed=True) from None
|
|
430
435
|
except library_pricing.LiveMemoryUnavailable as exc:
|
|
431
|
-
need = record.get("memory_bytes") or
|
|
436
|
+
need = record.get("memory_bytes") or memory_pools.memory_bytes(record["plan"])
|
|
432
437
|
raise _fail(
|
|
433
438
|
record,
|
|
434
439
|
LibraryError(
|
|
@@ -506,7 +511,7 @@ def _next_oom_rung(
|
|
|
506
511
|
"""Build the plan for posture rung ``next_index`` after an OOM failure on rung ``k``."""
|
|
507
512
|
if ctx.elastic is None or not ctx.elastic.ladder or next_index >= len(ctx.elastic.ladder):
|
|
508
513
|
return None
|
|
509
|
-
now =
|
|
514
|
+
now = memory_pools.live(facts, _reserved(model.id))
|
|
510
515
|
try:
|
|
511
516
|
next_elastic = library_elastic.price_elastic(
|
|
512
517
|
now,
|
|
@@ -667,8 +672,8 @@ def _admit(
|
|
|
667
672
|
if not library_status.answering(str(target["plan"]["endpoint"]["base_url"])):
|
|
668
673
|
continue
|
|
669
674
|
pool = target["pool"]
|
|
670
|
-
freed[pool] = freed.get(pool, 0) +
|
|
671
|
-
if
|
|
675
|
+
freed[pool] = freed.get(pool, 0) + memory_pools.memory_bytes(target["plan"])
|
|
676
|
+
if memory_pools.gpu_index(pool) is not None:
|
|
672
677
|
freed["system"] = freed.get("system", 0) + library_pricing.host_ram_bytes(
|
|
673
678
|
target["plan"], catalog
|
|
674
679
|
)
|
|
@@ -705,8 +710,6 @@ def load(
|
|
|
705
710
|
force: bool = False,
|
|
706
711
|
ctx: int | None = None,
|
|
707
712
|
) -> Row:
|
|
708
|
-
from localmodels import library_convert
|
|
709
|
-
|
|
710
713
|
if ctx is not None and (isinstance(ctx, bool) or ctx <= 0):
|
|
711
714
|
raise LibraryError("INVALID_STATE", "--ctx must be a positive integer")
|
|
712
715
|
library_convert.convert_once()
|
|
@@ -740,7 +743,7 @@ def load(
|
|
|
740
743
|
if other != model.id and found is not None and found["state"] != "idle":
|
|
741
744
|
targets.append(found)
|
|
742
745
|
_admit(model, record, targets, facts, load_ctx)
|
|
743
|
-
memory = record.get("memory_bytes") or
|
|
746
|
+
memory = record.get("memory_bytes") or memory_pools.memory_bytes(record["plan"])
|
|
744
747
|
port = _port(facts) # reserved with the claim: no concurrent load takes it too
|
|
745
748
|
claims = [library_state.acquire("load", model.id, record["pool"], memory, [], port=port)]
|
|
746
749
|
for target in targets:
|
|
@@ -780,8 +783,6 @@ def _claim(model: Model, kind: str) -> tuple[Record, Job]:
|
|
|
780
783
|
|
|
781
784
|
|
|
782
785
|
def unload(model_id: str, base_dir: str) -> Row:
|
|
783
|
-
from localmodels import library_convert
|
|
784
|
-
|
|
785
786
|
library_convert.convert_once()
|
|
786
787
|
model = library_pricing.find(model_id, library_pricing.entries())
|
|
787
788
|
record, job = _claim(model, "unload")
|
|
@@ -802,8 +803,6 @@ def _clear_removed_source(pi_model: str | None) -> None:
|
|
|
802
803
|
|
|
803
804
|
|
|
804
805
|
def remove(model_id: str, base_dir: str) -> Row:
|
|
805
|
-
from localmodels import library_convert
|
|
806
|
-
|
|
807
806
|
library_convert.convert_once()
|
|
808
807
|
model = library_pricing.find(model_id, library_pricing.entries())
|
|
809
808
|
record, job = _claim(model, "remove")
|
|
@@ -20,6 +20,7 @@ from pathlib import Path
|
|
|
20
20
|
from localmodels import (
|
|
21
21
|
app,
|
|
22
22
|
custom_hub,
|
|
23
|
+
draft_spec,
|
|
23
24
|
hosts,
|
|
24
25
|
library_jobs,
|
|
25
26
|
library_pricing,
|
|
@@ -99,8 +100,14 @@ def _build_smoke_plan(
|
|
|
99
100
|
*,
|
|
100
101
|
use_jinja: bool,
|
|
101
102
|
) -> Plan:
|
|
102
|
-
"""Build an ephemeral loopback smoke-test plan derived from ``record['plan']
|
|
103
|
+
"""Build an ephemeral loopback smoke-test plan derived from ``record['plan']``; an optional
|
|
104
|
+
drafter not verified in place is left out, as a load leaves it out."""
|
|
103
105
|
plan = copy.deepcopy(record["plan"])
|
|
106
|
+
if not any(
|
|
107
|
+
f["dest"] == draft_spec.drafter_dest(plan) and plan_envelope.verified_in_place(f)
|
|
108
|
+
for f in plan["files"]
|
|
109
|
+
):
|
|
110
|
+
plan = draft_spec.without_drafter(plan)
|
|
104
111
|
token_id = uuid.uuid4().hex[:10]
|
|
105
112
|
smoke_name = f"smoke-{token_id}"
|
|
106
113
|
base = base_dir.rstrip("/")
|