Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Keep a test's fake pid identity out of the cached owner identity (#11708)
Daniel Han245e505f3d99
diff --git a/studio/backend/tests/conftest.py b/studio/backend/tests/conftest.pyindex b94a3b504f1..0480dc8d49d 100644--- a/studio/backend/tests/conftest.py+++ b/studio/backend/tests/conftest.py@@ -321,6 +321,23 @@ def _isolate_generation_state():active_generations.reset_for_tests()[email protected](autouse = True)+def _forget_the_cached_owner_identity():+ """Drop ``process_lifetime``'s cached owner identity after each test.++ ``_own_identity`` reads this process's identity once and keeps it, which is right in a server,+ where it cannot change. A test that patches ``_pid_identity`` and then adopts a pid caches the+ fake instead: test_concurrent_adopts_all_survive left ``id-<pid>`` behind, and the next test in+ the same xdist worker to write a record wrote that, so the reaper read its own live owner as+ gone and killed the child test_a_live_owner_is_never_reaped had just adopted. The cache is+ recomputed on demand, so clearing it costs one ``ps`` at most.+ """+ yield+ lifetime = sys.modules.get("utils.process_lifetime")+ if lifetime is not None:+ lifetime._owner_identity = None++@pytest.fixture(autouse = True)def _isolate_wal_keepers():"""Close the WAL keepers a test opened, so the next test starts without them.diff --git a/studio/backend/tests/test_orphaned_children.py b/studio/backend/tests/test_orphaned_children.pyindex 6d86bbb4960..9e4d6521b1b 100644--- a/studio/backend/tests/test_orphaned_children.py+++ b/studio/backend/tests/test_orphaned_children.py@@ -461,6 +461,8 @@ def test_concurrent_adopts_all_survive(tmp_path, monkeypatch):pl._tracked_pids.clear()pids = list(range(900000, 900040))monkeypatch.setattr(pl, "_pid_identity", lambda pid: f"id-{pid}")+ # Adopting caches this process's identity through the fake above; keep that to this test.+ monkeypatch.setattr(pl, "_owner_identity", None)def adopt(chunk):for pid in chunk: