Skip to content

Commit e8ccf77

Browse files
committed
fix: Add type guards for mypy in saturation detection
Signed-off-by: Maryam Tahhan <mtahhan@redhat.com>
1 parent 7d80df5 commit e8ccf77

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/guidellm/benchmark/profiles.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,11 @@ def next_strategy( # noqa: C901
771771
prev_strategy
772772
and prev_strategy.type_ in ["constant", "poisson"]
773773
and prev_benchmark
774+
and hasattr(prev_strategy, "rate")
775+
and hasattr(prev_benchmark, "metrics")
774776
):
775-
target_rate = prev_strategy.rate
776-
achieved_rate = prev_benchmark.metrics.requests_per_second.successful.mean
777+
target_rate = prev_strategy.rate # type: ignore[attr-defined]
778+
achieved_rate = prev_benchmark.metrics.requests_per_second.successful.mean # type: ignore[attr-defined]
777779

778780
# If achieved rate is below threshold, system is saturated
779781
if achieved_rate < (target_rate * self.saturation_threshold):

0 commit comments

Comments
 (0)