guidellm.scheduler.schemas
Core data structures and interfaces for the GuideLLM scheduler system.
Provides type-safe abstractions for distributed request processing, timing measurements, and backend interfaces for benchmarking operations. Central to the scheduler architecture, enabling request lifecycle tracking, backend coordination, and state management across distributed worker processes.
BackendT = TypeVar('BackendT', bound=BackendInterface) module-attribute
Generic backend interface type for request processing
DatasetIterT = TypeAliasType('DatasetIterT', Iterable[Iterable[tuple[RequestT, RequestSettings]]], type_params=(RequestT,)) module-attribute
Output of data loader, an iterable of batches, where each batch is an iterable of (request, timestamp) tuples.
HistoryT = TypeAliasType('HistoryT', list[tuple[RequestT, ResponseT | None]], type_params=(RequestT, ResponseT)) module-attribute
Record of requests + responses in conversation.
RequestDataT = TypeAliasType('RequestDataT', tuple[RequestT, RequestInfo], type_params=(RequestT,)) module-attribute
Request including external metadata and scheduling config.
RequestT = TypeVar('RequestT') module-attribute
Generic request object type for scheduler processing
ResponseT = TypeVar('ResponseT') module-attribute
Generic response object type returned by backend 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.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.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.
Source code in src/guidellm/scheduler/schemas.py
SchedulerProgress
Bases: StandardBaseModel
Progress tracking data for scheduler operations.
Provides estimates for remaining work in scheduler operations, including fraction complete, request counts, and duration. Used by constraints and monitoring systems to track execution progress and make termination decisions.
Source code in src/guidellm/scheduler/schemas.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
remaining_duration_fraction property
Returns:
| Type | Description |
|---|---|
float | None | Estimated fraction of remaining duration, if known |
remaining_fraction property
Returns:
| Type | Description |
|---|---|
float | None | Estimated fraction of remaining progress, if known |
remaining_requests_fraction property
Returns:
| Type | Description |
|---|---|
float | None | Estimated fraction of remaining requests, if known |
combine(other)
Combine two progress instances, taking the minimum remaining estimates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other | SchedulerProgress | Another progress instance to combine with | required |
Returns:
| Type | Description |
|---|---|
SchedulerProgress | New progress instance with combined estimates |
Source code in src/guidellm/scheduler/schemas.py
SchedulerState
Bases: StandardBaseModel
Comprehensive state tracking for scheduler execution.
Tracks scheduler execution progress, request counts, timing information, and constraint enforcement. Central to scheduler coordination, providing real-time metrics for monitoring and decision-making across distributed worker processes.
Example: :: state = SchedulerState(node_id=0, num_processes=4) state.created_requests += 1 state.queued_requests += 1 completion_rate = state.processed_requests / state.created_requests
Source code in src/guidellm/scheduler/schemas.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | |
SchedulerUpdateAction
Bases: StandardBaseModel
Control directives for scheduler behavior and operations.
Encapsulates control signals for scheduler operations including request queuing and processing directives. Used by constraints to communicate termination conditions and progress to scheduler components.
Example: :: action = SchedulerUpdateAction( request_queuing="stop", request_processing="continue", metadata={"reason": "max_requests_reached"} )