MCPcopy
hub / github.com/ray-project/ray / get_rayllm_testing_model

Function get_rayllm_testing_model

python/ray/llm/tests/serve/conftest.py:197–229  ·  view source on GitHub ↗
(
    test_model_path: pathlib.Path,
)

Source from the content-addressed store, hash-verified

195
196@contextlib.contextmanager
197def get_rayllm_testing_model(
198 test_model_path: pathlib.Path,
199):
200 args = LLMServingArgs(llm_configs=[str(test_model_path.absolute())])
201 router_app = build_openai_app(args)
202 serve._run(router_app, name="router", _blocking=False)
203
204 wait_for_condition(
205 lambda: serve.status().applications["router"].status
206 == ApplicationStatus.RUNNING,
207 timeout=200,
208 retry_interval_ms=2000,
209 )
210
211 # Block until the deployment is ready
212 # Wait at most 200s [3 min]
213 client = openai.Client(
214 base_url="http://localhost:8000/v1", api_key="not_an_actual_key"
215 )
216 model_id = None
217 for _i in range(20):
218 try:
219 models = [model.id for model in client.models.list().data]
220 model_id = models[0]
221 assert model_id
222 break
223 except Exception as e:
224 print("Error", e)
225 pass
226 time.sleep(10)
227 if not model_id:
228 raise RuntimeError("Could not start model!")
229 yield client, model_id
230
231
232@pytest.fixture

Callers 2

testing_modelFunction · 0.85

Calls 9

LLMServingArgsClass · 0.90
build_openai_appFunction · 0.90
wait_for_conditionFunction · 0.90
printFunction · 0.85
rangeFunction · 0.50
_runMethod · 0.45
statusMethod · 0.45
listMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…