launch: an installed DeepSeek model whose config names a gone engine, with no package in this install, is not 'already installed': setup runs (feed download, or one plain line with the next step) instead of the start failing on a missing file; tests

This commit is contained in:
Niko1221 committed 2026-10-24 02:58:01 +02:00
1 parent 9011bd107a
commit 2ecdc2e511
2 files changed
+36 -1

No files matched your search

+13 -1
View File
@@ -925,7 +925,8 @@ class Runner:
if not (s.family and s.model):
raise LaunchError("No model was chosen.", "Choose a model, or use --model NAME (strata launch --help lists them).", 2)
path, desc = self.installed_state()
if path is not None and desc is not None and desc_matches(desc, s) and not files_present(read_config(path)):
if path is not None and desc is not None and desc_matches(desc, s) and not files_present(read_config(path)) \
and not self.dsv41_engine_missing(read_config(path)):
if self.installed_serves_request(path):
self.emit("model", f"{s.family} {s.model} is already installed with these choices.", 100)
return path
@@ -1838,6 +1839,17 @@ class Runner:
except Exception: # noqa: BLE001
return ""
def dsv41_engine_missing(self, cfg: dict) -> bool:
"""An installed DeepSeek model whose config names an engine that is gone (an older package folder an update removed, or another install's) while
this install has no DeepSeek engine package either: not 'already installed' - setup runs, which fetches the package through the feed or says in
one plain line what to do (--dsv41-package, or the engine-dsv41 folder), instead of the start failing on a missing file."""
if cfg.get("arch") != "deepseek41":
return False
exe = str(cfg.get("exe") or "")
if exe and Path(exe).is_file():
return False
return self.dsv41_engine_found()[0] is None
def use_own_dsv41_engine(self, cfg: dict) -> None:
"""DeepSeek: the run config's engine is the DeepSeek engine package of THIS install (engine-dsv41/ here), not the path the installed model's
config was written with: that config can come from another Strata install on this computer (the model is shared between installs) or name
+23
View File
@@ -153,3 +153,26 @@ class OwnEngine(unittest.TestCase):
cfg2 = {"arch": "deepseek41", "exe": "/old/strata-dsv41.exe", "lib_dirs": []}
fn2(f2, cfg2)
self.assertEqual(cfg2["exe"], "/old/strata-dsv41.exe")
class MissingEngine(unittest.TestCase):
"""This install has no DeepSeek engine package and the model config's exe is gone: not 'already installed'; setup decides (feed or a plain line)."""
def check(self, cfg, found):
from strata_cli.launch import runner as R
f = mock.MagicMock()
f.dsv41_engine_found.return_value = (found, True)
return R.Runner.dsv41_engine_missing(f, cfg)
def test_gone_exe_and_no_package_means_setup_runs(self):
self.assertTrue(self.check({"arch": "deepseek41", "exe": "C:/gone/engine-dsv41/0.1.48/strata-dsv41.exe"}, None))
self.assertTrue(self.check({"arch": "deepseek41"}, None))
def test_an_existing_exe_or_an_own_package_or_qwen_is_left_alone(self):
import tempfile
with tempfile.TemporaryDirectory() as d:
exe = Path(d) / "strata-dsv41.exe"
exe.write_bytes(b"x")
self.assertFalse(self.check({"arch": "deepseek41", "exe": str(exe)}, None))
self.assertFalse(self.check({"arch": "deepseek41", "exe": "C:/gone/x.exe"}, exe))
self.assertFalse(self.check({"arch": "qwen4exp", "exe": "component:strata-engine"}, None))