(
test_model_path: pathlib.Path,
)
| 195 | |
| 196 | @contextlib.contextmanager |
| 197 | def 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 |
no test coverage detected
searching dependent graphs…