diff --git a/setup.py b/setup.py index 71ee6627..c9b5fe0d 100644 --- a/setup.py +++ b/setup.py @@ -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 diff --git a/strata_control/runtime.py b/strata_control/runtime.py index 893df828..d054d652 100644 --- a/strata_control/runtime.py +++ b/strata_control/runtime.py @@ -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: diff --git a/tests/terminal/test_no_acquisition.py b/tests/terminal/test_no_acquisition.py index 1adca1a9..ec219860 100644 --- a/tests/terminal/test_no_acquisition.py +++ b/tests/terminal/test_no_acquisition.py @@ -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)