Skip to content

Commit 765c875

Browse files
authored
Indicate max_concurrency for throughput and disallow running standalone without --rate (#467)
## Summary <!-- Include a short paragraph of the changes introduced in this PR. If this PR requires additional context or rationale, explain why the changes are necessary. --> Add a indicator to throughput similar to concurrent's `concurrent@CONC`. Additionally require specifying `--rate` for throughput when running standalone rather than defaulting to `MAX_CONCURRENCY`. --- - [x] "I certify that all code in this PR is my own, except as noted below." ## Use of AI - [ ] Includes AI-assisted code completion - [ ] Includes code generated by an AI application - [ ] Includes AI-generated tests (NOTE: AI written tests should have a docstring that includes `## WRITTEN BY AI ##`)
2 parents 49ae751 + ad7308b commit 765c875

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/guidellm/benchmark/profiles.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,10 @@ def resolve_args(
432432
kwargs.pop("random_seed", None)
433433
if rate is not None and len(rate) > 0:
434434
kwargs["max_concurrency"] = rate[0]
435+
else:
436+
# Require explicit max_concurrency; in the future max_concurrency
437+
# should be dynamic and rate can specify some tunable
438+
raise ValueError("ThroughputProfile requires a rate parameter")
435439
return kwargs
436440

437441
@property

src/guidellm/scheduler/strategies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def __str__(self) -> str:
387387
"""
388388
:return: String identifier for throughput strategy
389389
"""
390-
return "throughput"
390+
return f"throughput@{self.max_concurrency or 'unlimited'}"
391391

392392
@property
393393
def processes_limit(self) -> PositiveInt | None:

tests/unit/scheduler/test_strategies.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,10 @@ def test_string_representation(
335335
self, valid_instances: tuple[ThroughputStrategy, dict]
336336
):
337337
"""Test __str__ method for ThroughputStrategy."""
338-
instance, _ = valid_instances
338+
instance, constructor_args = valid_instances
339+
max_concurrency = constructor_args.get("max_concurrency")
339340
result = str(instance)
340-
assert result == "throughput"
341+
assert result == f"throughput@{max_concurrency or 'unlimited'}"
341342

342343
@pytest.mark.smoke
343344
def test_marshalling(self, valid_instances: tuple[ThroughputStrategy, dict]):

0 commit comments

Comments
 (0)