Skip to content

Commit

Permalink
refactor to better handle creating profile generator
Browse files Browse the repository at this point in the history
  • Loading branch information
DaltheCow committed Jul 2, 2024
1 parent 9a0c582 commit fb1ebcb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/guidellm/executor/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ def __init__(
self,
request_generator: RequestGenerator,
backend: Backend,
profile_mode: Union[str, ProfileGenerationModes] = "fixed_rate",
rate_type: str = "sweep",
profile_args: Optional[Dict[str, Any]] = None,
max_requests: Optional[int] = None,
max_duration: Optional[float] = None,
):
self.request_generator = request_generator
self.backend = backend
profile_mode = "sweep"
if rate_type in {"synchronous", "constant", "poisson"}:
profile_mode = "fixed_rate"
self.profile = ProfileGenerator.create_generator(
profile_mode, **(profile_args or {})
)
Expand Down
3 changes: 1 addition & 2 deletions src/guidellm/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ def main(
raise ValueError(f"Unknown data type: {data_type}")

# Create executor
profile_mode = rate_type if rate_type == "sweep" else "fixed_rate"
executor = Executor(
request_generator=request_generator,
backend=backend,
profile_mode=profile_mode,
rate_type=rate_type,
profile_args={"rate_type": rate_type, "rate": rate},
max_requests=num_requests,
max_duration=num_seconds,
Expand Down

0 comments on commit fb1ebcb

Please sign in to comment.