Skip to content

Commit 835d292

Browse files
committed
fix case with only one benchmark
1 parent 917f4f6 commit 835d292

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/guidellm/benchmark/output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
StatusDistributionSummary,
2828
)
2929
from guidellm.presentation import UIDataBuilder
30+
from guidellm.presentation.injector import create_report
3031
from guidellm.scheduler import strategy_display_str
3132
from guidellm.utils import Colors, split_text_list_by_length
32-
from guidellm.utils.injector import create_report
3333

3434
__all__ = [
3535
"GenerativeBenchmarksConsole",

src/ui/lib/store/slices/benchmarks/benchmarks.selectors.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ const getDefaultMetricValues = () => ({
5959
export const selectInterpolatedMetrics = createSelector(
6060
[selectBenchmarks, selectSloState],
6161
(benchmarks, sloState) => {
62-
const sortedByRPS = benchmarks
63-
?.slice()
64-
?.sort((bm1, bm2) => (bm1.requestsPerSecond > bm2.requestsPerSecond ? 1 : -1));
65-
const requestRates = sortedByRPS?.map((bm) => bm.requestsPerSecond) || [];
66-
const { enforcedPercentile, currentRequestRate } = sloState;
6762
const metricData: {
6863
[K in keyof BenchmarkMetrics | 'mean']: {
6964
enforcedPercentileValue: number;
@@ -77,6 +72,14 @@ export const selectInterpolatedMetrics = createSelector(
7772
throughput: getDefaultMetricValues(),
7873
mean: getDefaultMetricValues(),
7974
};
75+
if ((benchmarks?.length || 0) < 2) {
76+
return metricData;
77+
}
78+
const sortedByRPS = benchmarks
79+
?.slice()
80+
?.sort((bm1, bm2) => (bm1.requestsPerSecond > bm2.requestsPerSecond ? 1 : -1));
81+
const requestRates = sortedByRPS?.map((bm) => bm.requestsPerSecond) || [];
82+
const { enforcedPercentile, currentRequestRate } = sloState;
8083
const metrics: (keyof BenchmarkMetrics)[] = [
8184
'ttft',
8285
'tpot',

0 commit comments

Comments
 (0)