11"""
22Benchmark execution orchestration and lifecycle management.
33
4- Provides the core benchmarking engine coordinating request scheduling,
5- data aggregation, and result compilation across execution strategies
6- and environments. The Benchmarker manages the complete benchmark lifecycle
7- from request submission through result compilation while supporting
8- thread-safe singleton operations for consistent state management.
4+ Provides the core benchmarking engine that coordinates request scheduling,
5+ data aggregation, and result compilation across execution strategies and
6+ environments. The Benchmarker manages the complete benchmark lifecycle from
7+ request submission through result compilation while implementing thread-safe
8+ singleton operations for consistent state management across concurrent workflows .
99"""
1010
1111from __future__ import annotations
1515from collections .abc import AsyncIterator , Iterable
1616from typing import Generic
1717
18- from guidellm .benchmark .profile import Profile
18+ from guidellm .benchmark .profiles import Profile
1919from guidellm .benchmark .progress import BenchmarkerProgress
2020from guidellm .benchmark .schemas import (
2121 BenchmarkAccumulatorT ,
2222 BenchmarkConfig ,
2323 BenchmarkT ,
2424)
25+ from guidellm .benchmark .schemas .base import TransientPhaseConfig
2526from guidellm .logger import logger
2627from guidellm .scheduler import (
2728 BackendInterface ,
@@ -45,13 +46,12 @@ class Benchmarker(
4546 ThreadSafeSingletonMixin ,
4647):
4748 """
48- Abstract benchmark orchestrator for request processing workflows .
49+ Orchestrates benchmark execution across scheduling strategies .
4950
50- Coordinates benchmarking runs across scheduling strategies, aggregating
51- metrics and compiling results. Manages the complete benchmark lifecycle
52- from request submission through result compilation while implementing a
53- thread-safe singleton pattern for consistent state across concurrent
54- operations.
51+ Coordinates benchmarking runs by managing request scheduling, metric aggregation,
52+ and result compilation. Implements a thread-safe singleton pattern to ensure
53+ consistent state management across concurrent operations while supporting multiple
54+ scheduling strategies and execution environments.
5555 """
5656
5757 async def run (
@@ -62,29 +62,30 @@ async def run(
6262 backend : BackendInterface [RequestT , ResponseT ],
6363 profile : Profile ,
6464 environment : Environment ,
65+ warmup : TransientPhaseConfig ,
66+ cooldown : TransientPhaseConfig ,
67+ sample_requests : int | None = 20 ,
68+ prefer_response_metrics : bool = True ,
6569 progress : (
6670 BenchmarkerProgress [BenchmarkAccumulatorT , BenchmarkT ] | None
6771 ) = None ,
68- sample_requests : int | None = 20 ,
69- warmup : float | None = None ,
70- cooldown : float | None = None ,
71- prefer_response_metrics : bool = True ,
7272 ) -> AsyncIterator [BenchmarkT ]:
7373 """
74- Execute benchmark runs across scheduling strategies defined in the profile.
74+ Execute benchmark runs across scheduling strategies in the profile.
7575
7676 :param accumulator_class: Class for accumulating metrics during execution
7777 :param benchmark_class: Class for constructing final benchmark results
7878 :param requests: Request datasets to process across strategies
7979 :param backend: Backend interface for executing requests
8080 :param profile: Profile defining scheduling strategies and constraints
8181 :param environment: Environment for execution coordination
82- :param progress: Optional tracker for benchmark lifecycle events
83- :param sample_requests: Number of requests to sample for estimation
84- :param warmup: Warmup duration in seconds before benchmarking
85- :param cooldown: Cooldown duration in seconds after benchmarking
82+ :param warmup: Warmup phase configuration before benchmarking
83+ :param cooldown: Cooldown phase configuration after benchmarking
84+ :param sample_requests: Number of requests to sample for estimation,
85+ defaults to 20
8686 :param prefer_response_metrics: Whether to prefer response metrics over
87- request metrics
87+ request metrics, defaults to True
88+ :param progress: Optional tracker for benchmark lifecycle events
8889 :yield: Compiled benchmark result for each strategy execution
8990 :raises Exception: If benchmark execution or compilation fails
9091 """
@@ -138,7 +139,6 @@ async def run(
138139 requests = requests ,
139140 backend = backend ,
140141 strategy = strategy ,
141- startup_duration = warmup if warmup and warmup >= 1 else 0.0 ,
142142 env = environment ,
143143 ** constraints or {},
144144 ):
0 commit comments