Skip to content

Commit 9d9392b

Browse files
Fix test output xfail ut (#439)
## Summary Fix two problems: 1. UT: tests/unit/benchmark/test_output:test_file_csv is marked as fail 2. some code quality check failure --- - [ ] "I certify that all code in this PR is my own, except as noted below." ## Use of AI - [ ] Includes AI-assisted code completion - [ ] Includes code generated by an AI application - [ ] Includes AI-generated tests (NOTE: AI written tests should have a docstring that includes `## WRITTEN BY AI ##`)
2 parents 7b07866 + 3bae160 commit 9d9392b

File tree

12 files changed

+23
-30
lines changed

12 files changed

+23
-30
lines changed

src/guidellm/benchmark/benchmarker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import uuid
1414
from abc import ABC
1515
from collections.abc import AsyncIterator, Iterable
16-
from typing import Generic
16+
from typing import Any, Generic
1717

1818
from guidellm.benchmark.profile import Profile
1919
from guidellm.benchmark.progress import BenchmarkerProgress

src/guidellm/data/deserializers/deserializer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ def _deserialize_with_registered_deserializers(
107107

108108
if len(errors) > 0:
109109
err_msgs = ""
110+
110111
def sort_key(item):
111112
return (isinstance(item[1], DataNotSupportedError), item[0])
113+
112114
for key, err in sorted(errors.items(), key=sort_key):
113115
err_msgs += f"\n - Deserializer '{key}': ({type(err).__name__}) {err}"
114116
raise ValueError(
@@ -141,4 +143,3 @@ def _deserialize_with_specified_deserializer(
141143
random_seed=random_seed,
142144
**data_kwargs,
143145
)
144-

src/guidellm/data/loaders.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
__all__ = ["DataLoader", "DatasetsIterator"]
1818

1919

20-
2120
class DatasetsIterator(TorchIterableDataset):
2221
def __init__(
2322
self,

src/guidellm/data/preprocessors/formatters.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ def __init__(
5656
self.stream: bool = stream
5757
self.max_tokens: int | None = max_tokens or max_completion_tokens
5858

59-
def __call__(
60-
self, columns: dict[str, list[Any]]
61-
) -> GenerationRequest:
59+
def __call__(self, columns: dict[str, list[Any]]) -> GenerationRequest:
6260
"""
6361
:param columns: A dict of GenerativeDatasetColumnType to Any
6462
"""
@@ -396,9 +394,7 @@ def __call__( # noqa: C901
396394
class GenerativeAudioTranslationRequestFormatter(
397395
GenerativeAudioTranscriptionRequestFormatter
398396
):
399-
def __call__(
400-
self, columns: dict[str, list[Any]]
401-
) -> GenerationRequest:
397+
def __call__(self, columns: dict[str, list[Any]]) -> GenerationRequest:
402398
result = super().__call__(columns)
403399
result.request_type = "audio_translations"
404400
return result

src/guidellm/data/preprocessors/mappers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,7 @@ def __init__(
167167
dict[GenerativeDatasetColumnType, list[tuple[int, str]]] | None
168168
)
169169

170-
def __call__(
171-
self, row: dict[str, Any]
172-
) -> dict[str, list[Any]]:
170+
def __call__(self, row: dict[str, Any]) -> dict[str, list[Any]]:
173171
if self.datasets_column_mappings is None:
174172
raise ValueError("DefaultGenerativeColumnMapper not setup with data.")
175173

src/guidellm/data/preprocessors/preprocessor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
@runtime_checkable
1414
class DatasetPreprocessor(Protocol):
15-
def __call__(self, item: dict[str, Any]) -> (
16-
GenerationRequest | dict[str, Any]): ...
15+
def __call__(self, item: dict[str, Any]) -> GenerationRequest | dict[str, Any]: ...
1716

1817

1918
@runtime_checkable

src/guidellm/preprocess/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def process_dataset(
238238
prompt_tokens: str | Path,
239239
output_tokens: str | Path,
240240
processor_args: dict[str, Any] | None = None,
241-
data_args: dict[str, Any] | None = None,
241+
data_args: dict[str, Any] | None = None, # noqa: ARG001
242242
short_prompt_strategy: ShortPromptStrategy = ShortPromptStrategy.IGNORE,
243243
pad_char: str | None = None,
244244
concat_delimiter: str | None = None,

src/guidellm/scheduler/strategies.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,10 @@ def init_processes_start(self, start_time: float):
506506
if self._processes_lock is None:
507507
raise RuntimeError("_processes_lock is None in init_processes_start")
508508
if self._offset is None:
509-
raise RuntimeError("_offset is None in init_processes_start; was "
510-
"init_processes_timings not called?")
509+
raise RuntimeError(
510+
"_offset is None in init_processes_start; was "
511+
"init_processes_timings not called?"
512+
)
511513
with self._processes_lock:
512514
self._offset.value = start_time
513515

@@ -527,11 +529,15 @@ async def next_request_time(self, offset: int) -> float:
527529
next_delay = self._random.expovariate(self.rate)
528530

529531
if self._processes_lock is None:
530-
raise RuntimeError("_processes_lock is None in next_request_time; was "
531-
"init_processes_timings not called?")
532+
raise RuntimeError(
533+
"_processes_lock is None in next_request_time; was "
534+
"init_processes_timings not called?"
535+
)
532536
if self._offset is None:
533-
raise RuntimeError("_offset is None in next_request_time; was "
534-
"init_processes_timings not called?")
537+
raise RuntimeError(
538+
"_offset is None in next_request_time; was "
539+
"init_processes_timings not called?"
540+
)
535541
with self._processes_lock:
536542
self._offset.value += next_delay
537543

src/guidellm/scheduler/worker.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ async def _process_next_request(self, target_start: float):
363363
async for resp, info in self.backend.resolve( # type: ignore[attr-defined]
364364
request, request_info, None
365365
):
366-
367366
response = resp
368367
request_info = info
369368
if request_info is None:
@@ -407,10 +406,7 @@ async def _dequeue_next_request(
407406
return request, request_info
408407

409408
async def _schedule_request(
410-
self,
411-
request: RequestT,
412-
request_info: RequestInfo,
413-
target_start: float
409+
self, request: RequestT, request_info: RequestInfo, target_start: float
414410
):
415411
current_time = time.time()
416412
request_info.timings.scheduled_at = current_time

src/guidellm/utils/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def parse_list_floats(ctx, param, value): # noqa: ARG001
3131
f"of floats/ints. Error: {e}"
3232
) from e
3333

34+
3435
def parse_json(ctx, param, value): # noqa: ARG001
3536
if value is None or value == [None]:
3637
return None

0 commit comments

Comments
 (0)