Skip to content

Commit 8fe4e2e

Browse files
committed
Refactors to enable tests for benchmarker package and supporting tools
1 parent 0c6f679 commit 8fe4e2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+8992
-3109
lines changed

src/guidellm/backend/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
GenerationRequestTimings,
1515
GenerationResponse,
1616
)
17+
from .openai import OpenAIHTTPBackend
1718

1819
__all__ = [
1920
"Backend",
2021
"BackendType",
2122
"GenerationRequest",
2223
"GenerationRequestTimings",
2324
"GenerationResponse",
25+
"OpenAIHTTPBackend",
2426
]

src/guidellm/backend/backend.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@
1111
BackendType: Literal type defining supported backend implementations.
1212
"""
1313

14-
from typing import Literal, Optional
14+
from __future__ import annotations
15+
16+
from abc import abstractmethod
17+
from typing import Literal
1518

1619
from guidellm.backend.objects import (
1720
GenerationRequest,
1821
GenerationRequestTimings,
1922
GenerationResponse,
2023
)
2124
from guidellm.scheduler import BackendInterface
22-
from guidellm.utils.registry import RegistryMixin
25+
from guidellm.utils import RegistryMixin
2326

2427
__all__ = [
2528
"Backend",
@@ -66,7 +69,7 @@ async def process_startup(self):
6669
"""
6770

6871
@classmethod
69-
def create(cls, type_: BackendType, **kwargs) -> "Backend":
72+
def create(cls, type_: BackendType, **kwargs) -> Backend:
7073
"""
7174
Create a backend instance based on the backend type.
7275
@@ -78,6 +81,12 @@ def create(cls, type_: BackendType, **kwargs) -> "Backend":
7881

7982
backend = cls.get_registered_object(type_)
8083

84+
if backend is None:
85+
raise ValueError(
86+
f"Backend type '{type_}' is not registered. "
87+
f"Available types: {list(cls.registry.keys()) if cls.registry else []}"
88+
)
89+
8190
return backend(**kwargs)
8291

8392
def __init__(self, type_: BackendType):
@@ -89,16 +98,23 @@ def __init__(self, type_: BackendType):
8998
self.type_ = type_
9099

91100
@property
92-
def processes_limit(self) -> Optional[int]:
101+
def processes_limit(self) -> int | None:
93102
"""
94103
:return: Maximum number of worker processes supported. None if unlimited.
95104
"""
96105
return None
97106

98107
@property
99-
def requests_limit(self) -> Optional[int]:
108+
def requests_limit(self) -> int | None:
100109
"""
101110
:return: Maximum number of concurrent requests supported globally.
102111
None if unlimited.
103112
"""
104113
return None
114+
115+
@abstractmethod
116+
async def default_model(self) -> str | None:
117+
"""
118+
:return: The default model name or identifier for generation requests.
119+
"""
120+
...

src/guidellm/backend/interface.py

Lines changed: 0 additions & 97 deletions
This file was deleted.

src/guidellm/backend/objects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
from pydantic import Field
1313

14-
from guidellm.objects.pydantic import StandardBaseModel
1514
from guidellm.scheduler import MeasuredRequestTimings
15+
from guidellm.utils import StandardBaseModel
1616

1717
__all__ = [
1818
"GenerationRequest",

src/guidellm/benchmark/__init__.py

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1-
from .aggregator import AggregatorT, BenchmarkAggregator, GenerativeBenchmarkAggregator
2-
from .benchmark import (
1+
from .aggregator import (
2+
Aggregator,
3+
CompilableAggregator,
4+
GenerativeRequestsAggregator,
5+
GenerativeStatsProgressAggregator,
6+
SchedulerStatsAggregator,
7+
SerializableAggregator,
8+
)
9+
from .benchmarker import Benchmarker
10+
from .entrypoints import benchmark_generative_text, reimport_benchmarks_report
11+
from .objects import (
312
Benchmark,
4-
BenchmarkArgs,
513
BenchmarkMetrics,
614
BenchmarkSchedulerStats,
715
BenchmarkT,
816
GenerativeBenchmark,
17+
GenerativeBenchmarksReport,
918
GenerativeMetrics,
1019
GenerativeRequestStats,
11-
GenerativeTextErrorStats,
12-
StatusBreakdown,
1320
)
14-
from .benchmarker import Benchmarker, BenchmarkerResult, GenerativeBenchmarker
15-
from .entrypoints import benchmark_generative_text, reimport_benchmarks_report
16-
from .output import GenerativeBenchmarksConsole, GenerativeBenchmarksReport
21+
from .output import (
22+
GenerativeBenchmarkerConsole,
23+
GenerativeBenchmarkerCSV,
24+
GenerativeBenchmarkerHTML,
25+
GenerativeBenchmarkerOutput,
26+
)
1727
from .profile import (
1828
AsyncProfile,
1929
ConcurrentProfile,
@@ -22,46 +32,43 @@
2232
SweepProfile,
2333
SynchronousProfile,
2434
ThroughputProfile,
25-
create_profile,
2635
)
2736
from .progress import (
28-
BenchmarkerProgressDisplay,
29-
BenchmarkerTaskProgressState,
30-
GenerativeTextBenchmarkerProgressDisplay,
31-
GenerativeTextBenchmarkerTaskProgressState,
37+
BenchmarkerProgress,
38+
BenchmarkerProgressGroup,
39+
GenerativeConsoleBenchmarkerProgress,
3240
)
3341

3442
__all__ = [
35-
"AggregatorT",
43+
"Aggregator",
3644
"AsyncProfile",
3745
"Benchmark",
38-
"BenchmarkAggregator",
39-
"BenchmarkArgs",
4046
"BenchmarkMetrics",
4147
"BenchmarkSchedulerStats",
4248
"BenchmarkT",
4349
"Benchmarker",
44-
"BenchmarkerProgressDisplay",
45-
"BenchmarkerResult",
46-
"BenchmarkerTaskProgressState",
50+
"BenchmarkerProgress",
51+
"BenchmarkerProgressGroup",
52+
"CompilableAggregator",
4753
"ConcurrentProfile",
4854
"GenerativeBenchmark",
49-
"GenerativeBenchmarkAggregator",
50-
"GenerativeBenchmarker",
51-
"GenerativeBenchmarksConsole",
55+
"GenerativeBenchmarkerCSV",
56+
"GenerativeBenchmarkerConsole",
57+
"GenerativeBenchmarkerHTML",
58+
"GenerativeBenchmarkerOutput",
5259
"GenerativeBenchmarksReport",
60+
"GenerativeConsoleBenchmarkerProgress",
5361
"GenerativeMetrics",
5462
"GenerativeRequestStats",
55-
"GenerativeTextBenchmarkerProgressDisplay",
56-
"GenerativeTextBenchmarkerTaskProgressState",
57-
"GenerativeTextErrorStats",
63+
"GenerativeRequestsAggregator",
64+
"GenerativeStatsProgressAggregator",
5865
"Profile",
5966
"ProfileType",
60-
"StatusBreakdown",
67+
"SchedulerStatsAggregator",
68+
"SerializableAggregator",
6169
"SweepProfile",
6270
"SynchronousProfile",
6371
"ThroughputProfile",
6472
"benchmark_generative_text",
65-
"create_profile",
6673
"reimport_benchmarks_report",
6774
]

0 commit comments

Comments
 (0)