batch¶
batch ¶
Attributes¶
Classes¶
BatchMetrics dataclass ¶
BatchMetrics(total_requests: int = 0, total_batches: int = 0, total_latency_ms: float = 0.0, current_queue_size: int = 0, current_batch_size: int = 0, rejected_requests: int = 0, processing_times: list[float] = list(), batch_sizes: list[int] = list())
Real-time batch processing metrics.
Attributes¶
total_requests class-attribute instance-attribute ¶
Total number of requests processed.
total_batches class-attribute instance-attribute ¶
Total number of batches executed.
total_latency_ms class-attribute instance-attribute ¶
Cumulative latency in milliseconds.
current_queue_size class-attribute instance-attribute ¶
Current number of items in queue.
current_batch_size class-attribute instance-attribute ¶
Current batch size being used.
rejected_requests class-attribute instance-attribute ¶
Number of rejected requests due to queue full.
processing_times class-attribute instance-attribute ¶
Recent processing times (sliding window).
batch_sizes class-attribute instance-attribute ¶
Recent batch sizes (sliding window).
Functions¶
add_batch ¶
Record a batch execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch_size | int | Size of the batch processed. | required |
processing_time | float | Time taken to process (seconds). | required |
window_size | int | Maximum number of recent measurements to keep. | 50 |
Source code in inferflow/batch/__init__.py
BatchStrategy ¶
Abstract batch processing strategy.
A batch strategy manages
- Request queuing
- Batch formation
- Batch execution
- Result distribution
Example
Source code in inferflow/batch/__init__.py
Attributes¶
Functions¶
submit abstractmethod ¶
start abstractmethod ¶
stop abstractmethod ¶
get_metrics ¶
get_metrics() -> BatchMetrics