refactor(lab): move execution to Worker and manage replay and transfer lifecycles
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
"""Current admission and build must not depend on the retired combined LAB."""
|
||||
|
||||
import json
|
||||
import runpy
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from k1link.observatory.portable_run_definitions import PortableRunDefinitionRegistry
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def test_current_registry_preserves_both_models_without_fixed_lab():
|
||||
doc = json.loads((ROOT / "config/observatory-portable-run-definitions.json").read_text())
|
||||
defs = {d["setup_id"]: d for d in doc["definitions"]}
|
||||
assert "lab-v1-eomt-ddrnet-portable-v1" not in defs
|
||||
old = json.loads(
|
||||
(
|
||||
ROOT
|
||||
/ "tests/fixtures/observatory/retired-fixed-lab"
|
||||
/ "observatory-portable-run-definitions.json"
|
||||
).read_text()
|
||||
)["definitions"][0]
|
||||
models = {
|
||||
m["release_id"]: m
|
||||
for key in ("ai-segmentation-ddrnet-v1", "ai-segmentation-eomt-v1")
|
||||
for m in defs[key]["models"]
|
||||
}
|
||||
assert all(models[m["release_id"]] == m for m in old["models"])
|
||||
registry = PortableRunDefinitionRegistry.from_file(
|
||||
ROOT / "config/observatory-portable-run-definitions.json"
|
||||
)
|
||||
assert len(registry.ready_recorded_definitions()) == 5
|
||||
|
||||
|
||||
def test_old_promotion_cli_cannot_reinstall_fixed_lab():
|
||||
with pytest.raises(SystemExit, match="retired"):
|
||||
runpy.run_path(
|
||||
str(
|
||||
ROOT
|
||||
/ "experiments/perception/worker/observatory_portable"
|
||||
/ "promote_installed_lab_v1_package.py"
|
||||
),
|
||||
run_name="__main__",
|
||||
)
|
||||
|
||||
|
||||
def test_modular_builder_no_longer_executes_legacy_promotion(monkeypatch):
|
||||
original = runpy.run_path
|
||||
|
||||
def checked(path, *a, **kw):
|
||||
assert "promote_installed_lab_v1" not in str(path)
|
||||
return original(path, *a, **kw)
|
||||
|
||||
monkeypatch.setattr(runpy, "run_path", checked)
|
||||
module = runpy.run_path(str(ROOT / "scripts/build_modular_ai_worker_release.py"))
|
||||
assert module["_DDRNET_ASSETS"][0][0] == "ddrnet-checkpoint"
|
||||
|
||||
|
||||
def test_build_current_modular_release_without_fixed_definition(tmp_path):
|
||||
module = runpy.run_path(str(ROOT / "scripts/build_modular_ai_worker_release.py"))
|
||||
output = tmp_path / "release"
|
||||
module["build"](
|
||||
output=output,
|
||||
agent_image="1" * 64,
|
||||
camera_image="2" * 64,
|
||||
ddrnet_image="3" * 64,
|
||||
eomt_image="4" * 64,
|
||||
rf_detr_image="5" * 64,
|
||||
object_distance_image="6" * 64,
|
||||
source_tree_sha="7" * 64,
|
||||
engine_release_root=r"D:\runtime\release",
|
||||
engine_work_root=r"D:\runtime\work",
|
||||
)
|
||||
registry = PortableRunDefinitionRegistry.from_file(
|
||||
output / "observatory-portable-run-definitions.json"
|
||||
)
|
||||
assert len(registry.ready_recorded_definitions()) == 5
|
||||
assert all(d.setup_id != "lab-v1-eomt-ddrnet-portable-v1" for d in registry.definitions)
|
||||
Reference in New Issue
Block a user