a started server and a managed runtime's server are told not to acquire (STRATA_NO_ACQUIRE=1)

setup.start passes it to the server it spawns (subprocess.call env, or execve for Docker); the runtime host sets it in
the owned server's environment. The test checks the start's child environment.
This commit is contained in:
Niko1221 committed 2026-10-15 12:33:40 +02:00
1 parent 236cca71bb
commit b73ea23b68
3 files changed
+7 -3

No files matched your search

+3 -2
View File
@@ -5136,8 +5136,9 @@ def _start(cfg_path: Path, port: int | None, gpu: int | list | None = None, open
# Replace this process instead of spawning a child. The Docker image sets STRATA_EXECV=1,
# so there the server is PID 1 and docker stop's SIGTERM reaches the process that can
# answer the engine with QUIT. Normal Linux starts keep spawning the server as a child.
os.execv(cmd[0], cmd)
return subprocess.call(cmd)
os.execve(cmd[0], cmd, {**os.environ, acquisition.ENV: "1"})
# the server and everything it starts are told, too: nothing in a running model installs or downloads
return subprocess.call(cmd, env={**os.environ, acquisition.ENV: "1"})
# the draft subsets setup copied before (sha256): replaced by the current one, a subset made by hand is kept
+1
View File
@@ -652,6 +652,7 @@ class Host:
expected_attestation = launch_identity.attestation(attestation_key, source_bytes, server_args)
child_env = os.environ.copy()
child_env["STRATA_OWNER_ATTEST_KEY"] = attestation_key.hex()
child_env["STRATA_NO_ACQUIRE"] = "1" # a managed server never installs or downloads (acquisition.py)
try:
with os.fdopen(descriptor, "ab") as stream:
if WINDOWS:
+3 -1
View File
@@ -202,7 +202,8 @@ class StartNeverAcquiresTests(unittest.TestCase):
st.enter_context(mock.patch.object(subprocess, n, rec.program))
st.enter_context(mock.patch.object(setup, "gpus", lambda: gpus or []))
st.enter_context(mock.patch.object(setup, "call_server", create=True))
st.enter_context(mock.patch.object(setup.subprocess, "call", lambda cmd, *a, **k: started.append(cmd) or 0))
st.enter_context(mock.patch.object(setup.subprocess, "call", lambda cmd, *a, **k: (
started.append(cmd), setattr(self, "env_of_start", (k.get("env") or {}).get(acquisition.ENV)), 0)[-1]))
st.enter_context(contextlib.redirect_stdout(out))
try:
code = setup.main()
@@ -220,6 +221,7 @@ class StartNeverAcquiresTests(unittest.TestCase):
self.assertEqual(rec.installers(), [])
self.assertEqual(len(started), 1, text) # the server was started
self.assertIn("server.py", " ".join(started[0]))
self.assertEqual(self.env_of_start, "1") # the server is told, too
self.assertIn("is older than this Strata expects", text)
self.assertIn("UPDATE", text)