|
9 | 9 | from pydantic import Field, PositiveInt, field_validator |
10 | 10 |
|
11 | 11 | from guidellm.benchmark.schemas import ProfileArgs |
| 12 | +from guidellm.logger import logger |
12 | 13 | from guidellm.scheduler import ( |
13 | 14 | ConcurrentStrategy, |
14 | 15 | ConstraintInitializer, |
@@ -48,7 +49,13 @@ def _coerce_streams_to_list(cls, value: Any) -> Any: |
48 | 49 | if not value: |
49 | 50 | raise ValueError("streams requires at least one value") |
50 | 51 | if isinstance(value, list | tuple): |
51 | | - return [int(stream) for stream in value] |
| 52 | + streams = [int(stream) for stream in value] |
| 53 | + sorted_streams = sorted(streams) |
| 54 | + if sorted_streams != streams: |
| 55 | + logger.warning( |
| 56 | + f"Streams reordered from {streams} to {sorted_streams} (ascending)" |
| 57 | + ) |
| 58 | + return sorted_streams |
52 | 59 | if isinstance(value, int | float): |
53 | 60 | return [int(value)] |
54 | 61 | raise ValueError( |
@@ -93,15 +100,23 @@ def next_strategy( |
93 | 100 | """ |
94 | 101 | Generate concurrent strategy for next stream count. |
95 | 102 |
|
96 | | - :param prev_strategy: Previously completed strategy (unused) |
97 | | - :param prev_benchmark: Benchmark results from previous execution (unused) |
| 103 | + Stream counts are sorted ascending, so if a previous stream count was |
| 104 | + terminated by a failure constraint (over-saturation, errors, etc.), all |
| 105 | + remaining higher stream counts are skipped. |
| 106 | +
|
| 107 | + :param prev_strategy: Previously completed strategy |
| 108 | + :param prev_benchmark: Benchmark results from previous execution |
98 | 109 | :return: ConcurrentStrategy with next stream count, or None if complete |
| 110 | + or failure detected |
99 | 111 | """ |
100 | | - _ = (prev_strategy, prev_benchmark) # unused |
| 112 | + _ = prev_strategy |
101 | 113 |
|
102 | 114 | if len(self.completed_strategies) >= len(self.args.streams): |
103 | 115 | return None |
104 | 116 |
|
| 117 | + if prev_benchmark is not None and self._should_stop_escalating(prev_benchmark): |
| 118 | + return None |
| 119 | + |
105 | 120 | return ConcurrentStrategy( |
106 | 121 | streams=self.args.streams[len(self.completed_strategies)], |
107 | 122 | rampup_duration=self.args.rampup_duration, |
|
0 commit comments