@@ -63,13 +63,26 @@ def lora_adapter_path(request: pytest.FixtureRequest) -> str:
63
63
return path
64
64
65
65
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
+
66
78
@pytest .fixture (scope = "session" )
67
79
def args ( # noqa: PLR0913
68
80
request : pytest .FixtureRequest ,
69
81
monkeysession ,
70
82
grpc_server_port : ArgFixture [int ],
71
83
http_server_port : ArgFixture [int ],
72
84
lora_available : ArgFixture [bool ],
85
+ disable_frontend_multiprocessing ,
73
86
) -> argparse .Namespace :
74
87
"""Return parsed CLI arguments for the adapter/vLLM."""
75
88
# avoid parsing pytest arguments as vllm/vllm_tgis_adapter arguments
@@ -81,6 +94,9 @@ def args( # noqa: PLR0913
81
94
82
95
extra_args .extend (("--enable-lora" , f"--lora-modules={ name } ={ path } " ))
83
96
97
+ if disable_frontend_multiprocessing :
98
+ extra_args .append ("--disable-frontend-multiprocessing" )
99
+
84
100
monkeysession .setattr (
85
101
sys ,
86
102
"argv" ,
@@ -185,3 +201,13 @@ def target():
185
201
task .cancel ()
186
202
187
203
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