Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/compass/test_rapidserve_runner_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from types import SimpleNamespace

import pytest
import test_runner_rpc_surface as surface
from transformers import PretrainedConfig

import atom.config as config_module
Expand Down Expand Up @@ -48,3 +49,21 @@ def test_a_rapidserve_runner_is_accepted(monkeypatch, qualname):
named = {} if qualname is None else {"runner_qualname": qualname}
config = _config(monkeypatch, enable_rapidserve=True, **named)
assert config.runner_qualname == (qualname or RAPID)


def test_the_rpcs_named_are_the_waits_only_the_rapidserve_cores_make():
"""`RAPIDSERVE_RPCS` is the waited names `PrefillEngineCore` and
`DecodeEngineCore` broadcast that `ModelRunner` lacks, and also the
broadcast names `RapidServeModelRunner` defines and `ModelRunner` lacks."""
classes = surface._classes(surface.ENGINE / "engine_core.py")
cores = [classes["PrefillEngineCore"], classes["DecodeEngineCore"]]
waited = {
name
for name, sites in surface.SITES.items()
for s in sites
if s.waits
and s.file == "engine_core.py"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking. An observation, not a change request: s.file is a basename, so a second engine_core.py is filtered by this file's class line ranges.

Site.file is path.name (test_runner_rpc_surface.py, _call_sites), and the tree has two files with that name: atom/model_engine/engine_core.py and atom/diffusion/engine/engine_core.py. This filter passes sites from both, then checks their line numbers against PrefillEngineCore/DecodeEngineCore in the first one.

Measured (X4, xiaobizh_n18_cpu, copy of merged tree 265770218). I appended 700 comment lines to atom/diffusion/engine/engine_core.py and then a module-level call_func("diffusion_only_rpc", wait_out=True), which lands at line 939, inside PrefillEngineCore's range. Result: 1 failed, 7 passed, failing on this test at :69. That red is false, because no RapidServe core makes that call.

It is latent today. The diffusion file has 235 lines and no call_func, so it would have to grow past line 816 before this could fire. The precise fix, carrying the relative path in Site, is in test_runner_rpc_surface.py, outside this PR's file set, and the false red is loud rather than silent. So I am not asking for a change and not filing an issue. Principle 6 ("Refuse rather than fall back. A declined answer with a named reason is a result. A guessed one is a defect.") is the reason to record it: file identity is guessed from the basename here.

and any(c.lineno <= s.line <= c.end_lineno for c in cores)
}
rapid_only = (set(surface.SITES) & surface.RAPID) - surface.BASE
assert set(config_module.RAPIDSERVE_RPCS) == waited - surface.BASE == rapid_only