guidellm.scheduler.constraints.request
Request-based constraint implementations.
Provides constraint types for limiting benchmark execution based on request counts and time duration. These constraints monitor request creation, processing, and elapsed time to determine when to stop benchmark execution.
MaxDurationConstraint
Bases: PydanticConstraintInitializer
Constraint that limits execution based on maximum time duration.
Stops both request queuing and processing when the elapsed time since scheduler start exceeds the maximum duration. Provides progress tracking based on remaining time and completion fraction.
Source code in src/guidellm/scheduler/constraints/request.py
__call__(state, request_info)
Evaluate constraint against current scheduler state and elapsed time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state | SchedulerState | Current scheduler state with start time | required |
request_info | RequestInfo | None | Individual request information (unused) | required |
Returns:
| Type | Description |
|---|---|
SchedulerUpdateAction | Action indicating whether to continue or stop operations |
Source code in src/guidellm/scheduler/constraints/request.py
create_constraint(**_kwargs)
Return self as the constraint instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kwargs | Additional keyword arguments (unused) | required |
Returns:
| Type | Description |
|---|---|
Constraint | Self instance as the constraint |
Source code in src/guidellm/scheduler/constraints/request.py
MaxNumberConstraint
Bases: PydanticConstraintInitializer
Constraint that limits execution based on maximum request counts.
Stops request queuing when created requests reach the limit and stops local request processing when processed requests reach the limit. Provides progress tracking based on remaining requests and completion fraction.
Source code in src/guidellm/scheduler/constraints/request.py
__call__(state, request_info)
Evaluate constraint against current scheduler state and request count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state | SchedulerState | Current scheduler state with request counts | required |
request_info | RequestInfo | None | Individual request information, or | required |
Returns:
| Type | Description |
|---|---|
SchedulerUpdateAction | Action indicating whether to continue or stop operations |
Source code in src/guidellm/scheduler/constraints/request.py
create_constraint(**_kwargs)
Return self as the constraint instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kwargs | Additional keyword arguments (unused) | required |
Returns:
| Type | Description |
|---|---|
Constraint | Self instance as the constraint |
Source code in src/guidellm/scheduler/constraints/request.py
MinNumberConstraint
Bases: PydanticConstraintInitializer
Constraint that limits execution based on processed request counts.
Stops request queuing and local request processing when processed requests reach the limit. Unlike MaxNumberConstraint, queuing is not stopped when created requests reach the limit, which keeps the request pipeline full and avoids throughput tail-off at the end of a benchmark.
Source code in src/guidellm/scheduler/constraints/request.py
__call__(state, request_info)
Evaluate constraint against current scheduler state and request count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state | SchedulerState | Current scheduler state with request counts | required |
request_info | RequestInfo | None | Individual request information, or | required |
Returns:
| Type | Description |
|---|---|
SchedulerUpdateAction | Action indicating whether to continue or stop operations |
Source code in src/guidellm/scheduler/constraints/request.py
create_constraint(**_kwargs)
Return self as the constraint instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kwargs | Additional keyword arguments (unused) | required |
Returns:
| Type | Description |
|---|---|
Constraint | Self instance as the constraint |
Source code in src/guidellm/scheduler/constraints/request.py
RequestsExhaustedConstraint
Bases: StandardBaseModel, InfoMixin
Source code in src/guidellm/scheduler/constraints/request.py
info property
Extract serializable information from this constraint initializer.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Dictionary containing constraint configuration and metadata |