Skip to content

Commit d9dad85

Browse files
fix: ruff errors
1 parent f1d9db9 commit d9dad85

File tree

4 files changed

+21
-24
lines changed

4 files changed

+21
-24
lines changed

tests/e2e/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
The E2E tests in GuideLLM use the [vLLM simulator by llm-d](https://llm-d.ai/docs/architecture/Components/inf-simulator), to run them run the following command:
33
```shell
44
docker build . -f tests/e2e/vllm-sim.Dockerfile -o type=local,dest=./
5-
```
5+
```

tests/e2e/test_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_basic_report(server: VllmSimServer):
4040
--data "prompt_tokens=256,output_tokens=128" \
4141
--output-path {report_path}
4242
"""
43-
logger.info(f"Client command: {command}") # guidellm benchmark --target "http://127.0.0.1:8000" --rate-type constant --rate 5 --max-seconds 5 --data "prompt_tokens=256,output_tokens=128"
43+
logger.info(f"Client command: {command}")
4444
os.system(command) # noqa: S605
4545

4646
assert report_path.exists()

tests/e2e/test_interrupted.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# test_server_interaction.py
22

33
import json
4-
import os
5-
from pathlib import Path
64
import subprocess
75
import time
8-
6+
from pathlib import Path
97

108
import pytest
119
from loguru import logger
@@ -44,7 +42,7 @@ def test_interrupted_report(server: VllmSimServer):
4442
--data "prompt_tokens=256,output_tokens=128" \
4543
--output-path {report_path}
4644
"""
47-
logger.info(f"Client command: {command}") # guidellm benchmark --target "http://127.0.0.1:8000" --rate-type constant --rate 5 --max-seconds 5 --data "prompt_tokens=256,output_tokens=128"
45+
logger.info(f"Client command: {command}")
4846
process = subprocess.Popen(["/bin/bash", "-c", command], # noqa: S603
4947
stdout=subprocess.PIPE,
5048
stderr=subprocess.PIPE,

tests/e2e/vllm_sim_server.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import subprocess
22
import time
3+
from typing import Optional
34

45
import pytest
56
import requests
@@ -16,15 +17,15 @@ def __init__(
1617
self,
1718
port: int,
1819
model: str,
19-
lora: list[str] | None = None,
20-
mode: str | None = None,
21-
echo: bool | None = None,
22-
random: bool | None = None,
23-
time_to_first_token: float | None = None,
24-
inter_token_latency: float | None = None,
25-
max_loras: int | None = None,
26-
max_cpu_loras: int | None = None,
27-
max_running_requests: int | None = None,
20+
lora: Optional[list[str]] = None,
21+
mode: Optional[str] = None,
22+
echo: Optional[bool] = None,
23+
random: Optional[bool] = None,
24+
time_to_first_token: Optional[float] = None,
25+
inter_token_latency: Optional[float] = None,
26+
max_loras: Optional[int] = None,
27+
max_cpu_loras: Optional[int] = None,
28+
max_running_requests: Optional[int] = None,
2829
):
2930
self.port = port
3031
self.model = model
@@ -40,13 +41,10 @@ def __init__(
4041
self.server_url = f"http://127.0.0.1:{self.port}"
4142
self.health_url = f"{self.server_url}/health"
4243
self.app_script = "./bin/llm-d-inference-sim"
43-
self.process = None
44+
self.process: Optional[subprocess.Popen] = None
4445

4546
def get_cli_parameters(self) -> list[str]:
46-
parameters = [
47-
"--port", f"{self.port}",
48-
"--model", self.model
49-
]
47+
parameters = ["--port", f"{self.port}", "--model", self.model]
5048
if self.lora is not None:
5149
parameters.extend(["--lora", ",".join(self.lora)])
5250
if self.mode is not None:
@@ -64,19 +62,20 @@ def get_cli_parameters(self) -> list[str]:
6462
if self.max_cpu_loras is not None:
6563
parameters.extend(["--max-cpu-loras", f"{self.max_cpu_loras}"])
6664
if self.max_running_requests is not None:
67-
parameters.extend(["--max-running-requests", f"{self.max_running_requests}"])
65+
parameters.extend(
66+
["--max-running-requests", f"{self.max_running_requests}"]
67+
)
6868
return parameters
6969

7070
def start(self):
7171
"""
7272
Starts the server process and waits for it to become healthy.
7373
"""
7474

75-
logger.info(f"Starting server on {self.server_url}"
76-
f" using {self.app_script}...")
75+
logger.info(f"Starting server on {self.server_url} using {self.app_script}...")
7776
cli_parameters = self.get_cli_parameters()
7877
command = " ".join([self.app_script, *cli_parameters])
79-
logger.info(f"Server command: {command}") # ./bin/llm-d-inference-sim --model databricks/dolly-v2-12b --port 8000
78+
logger.info(f"Server command: {command}")
8079
self.process = subprocess.Popen( # noqa: S603
8180
[self.app_script, *cli_parameters],
8281
stdout=subprocess.PIPE,

0 commit comments

Comments
 (0)