Skip to content

Commit a159b46

Browse files
committed
tests: parametrize over --disable-frontend-multiprocessing
1 parent d6068bb commit a159b46

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/conftest.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,26 @@ def lora_adapter_path(request: pytest.FixtureRequest) -> str:
6363
return path
6464

6565

66+
@pytest.fixture(
67+
scope="session",
68+
params=[
69+
pytest.param(True, id="disable-frontend-multiprocessing=True"),
70+
pytest.param(False, id="disable-frontend-multiprocessing=False"),
71+
],
72+
)
73+
def disable_frontend_multiprocessing(request):
74+
"""Enable or disable the frontend-multiprocessing feature."""
75+
return request.param
76+
77+
6678
@pytest.fixture(scope="session")
6779
def args( # noqa: PLR0913
6880
request: pytest.FixtureRequest,
6981
monkeysession,
7082
grpc_server_port: ArgFixture[int],
7183
http_server_port: ArgFixture[int],
7284
lora_available: ArgFixture[bool],
85+
disable_frontend_multiprocessing,
7386
) -> argparse.Namespace:
7487
"""Return parsed CLI arguments for the adapter/vLLM."""
7588
# avoid parsing pytest arguments as vllm/vllm_tgis_adapter arguments
@@ -81,6 +94,9 @@ def args( # noqa: PLR0913
8194

8295
extra_args.extend(("--enable-lora", f"--lora-modules={name}={path}"))
8396

97+
if disable_frontend_multiprocessing:
98+
extra_args.append("--disable-frontend-multiprocessing")
99+
84100
monkeysession.setattr(
85101
sys,
86102
"argv",
@@ -185,3 +201,13 @@ def target():
185201
task.cancel()
186202

187203
t.join()
204+
205+
# Workaround: Instantiating the TGISStatLogger multiple times creates
206+
# multiple Gauges etc which can only be instantiated once.
207+
# By unregistering the Collectors from the REGISTRY we can
208+
# work around this problem.
209+
210+
from prometheus_client.registry import REGISTRY
211+
212+
for name in list(REGISTRY._collector_to_names.keys()): # noqa: SLF001
213+
REGISTRY.unregister(name)

0 commit comments

Comments
 (0)