guidellm.scheduler.schemas.backend
BackendT = TypeVar('BackendT', bound=BackendInterface) module-attribute
Generic backend interface type for request processing
BackendInterface
Bases: Protocol, Generic[RequestT, ResponseT]
Protocol defining the interface for request processing backends.
Establishes the contract for backend implementations that process requests within the scheduler system. Backends manage initialization, validation, processing, and shutdown lifecycle. All properties must be pickleable before process_startup is called for multi-process environments.
Example: :: class CustomBackend(BackendInterface): @property def processes_limit(self) -> int: return 4
async def resolve(self, request, request_info, history=None):
yield response, updated_request_info
Source code in src/guidellm/scheduler/schemas/backend.py
info property
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Backend metadata including model initialization and configuration |
processes_limit property
Returns:
| Type | Description |
|---|---|
int | None | Maximum worker processes supported, or None if unlimited |
requests_limit property
Returns:
| Type | Description |
|---|---|
int | None | Maximum concurrent requests supported, or None if unlimited |
process_shutdown() async
Perform backend cleanup and shutdown procedures.
Raises:
| Type | Description |
|---|---|
Exception | Implementation-specific exceptions for shutdown failures |
process_startup() async
Perform backend initialization and startup procedures.
Raises:
| Type | Description |
|---|---|
Exception | Implementation-specific exceptions for startup failures |
resolve(request, request_info, history=None) async
Process a request and yield incremental response updates.
:yield: Tuples of (response, updated_request_info) for each response chunk. Response may be None for intermediate updates (e.g., first token arrival).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request | RequestT | The request object to process | required |
request_info | RequestInfo | Scheduling metadata and timing information | required |
history | HistoryT[RequestT, ResponseT] | None | Conversation history for multi-turn requests | None |
Raises:
| Type | Description |
|---|---|
Exception | Implementation-specific exceptions for processing failures |
Source code in src/guidellm/scheduler/schemas/backend.py
validate() async
Validate backend configuration and operational status.
Raises:
| Type | Description |
|---|---|
Exception | Implementation-specific exceptions for validation failures |
SchedulerMessagingPydanticRegistry
Bases: RegistryMixin[RegistryObjT]
Registry for Pydantic types used in scheduler inter-process messaging.
Enables generic interface for defining Pydantic class types used for communication between distributed scheduler components and worker processes.