Skip to content

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.

Studio backend tests: pin the logical CPU count in the oversubscribed-threads spill test (#11120)

Daniel Han653d4ec6c3f8
diff --git a/studio/backend/tests/test_offload_planner_seam.py b/studio/backend/tests/test_offload_planner_seam.py
index eed5ada47eb..cdd6fd8ea3f 100644
--- a/studio/backend/tests/test_offload_planner_seam.py
+++ b/studio/backend/tests/test_offload_planner_seam.py
@@ -1836,6 +1836,13 @@ def test_oversubscribed_decode_threads_decline_spill_planning(monkeypatch):
monkeypatch.setattr(
llama_mod.os, "sched_getaffinity", lambda _pid: set(range(16)), raising = False
)
+ # The affinity above has to read as UNRESTRICTED, which means it must match the
+ # host's logical count, and _spilled_decode_threads takes that from psutil. Left
+ # real it is whatever the CI box has: on anything wider than 16 threads the 16-CPU
+ # affinity looks like a taskset, the pricing declines for that reason instead, and
+ # the oversubscription this test is about is never reached. _SmtHost is the 16/8
+ # host the surrounding affinity tests already pin for the same reason.
+ monkeypatch.setitem(sys.modules, "psutil", _SmtHost)
assert _plan(_Stub(), free_mib = 14 * 1024, extra_args = ["--threads", "16"]) is None
plan = _plan(
_Stub(),