pub trait Scheduler: Send + Sync {
// Required methods
fn submit<'life0, 'async_trait>(
&'life0 self,
request: InferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<RequestId, FerrumError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn next_batch<'life0, 'async_trait>(
&'life0 self,
hint: BatchHint,
) -> Pin<Box<dyn Future<Output = Option<BatchPlan>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
request_id: RequestId,
response: &'life1 InferenceResponse,
) -> Pin<Box<dyn Future<Output = Result<(), FerrumError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn cancel<'life0, 'async_trait>(
&'life0 self,
request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<bool, FerrumError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn update_priority<'life0, 'async_trait>(
&'life0 self,
request_id: RequestId,
priority: Priority,
) -> Pin<Box<dyn Future<Output = Result<(), FerrumError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn metrics(&self) -> SchedulerStats;
fn config(&self) -> &SchedulerConfig;
// Provided methods
fn request_state(&self, request_id: &RequestId) -> Option<RequestState> { ... }
fn preempt<'life0, 'async_trait>(
&'life0 self,
_request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<PreemptionResult, FerrumError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
fn resume<'life0, 'async_trait>(
&'life0 self,
_request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<(), FerrumError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
}Expand description
Main scheduler trait for request management and batching
Required Methods§
Sourcefn submit<'life0, 'async_trait>(
&'life0 self,
request: InferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<RequestId, FerrumError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn submit<'life0, 'async_trait>(
&'life0 self,
request: InferenceRequest,
) -> Pin<Box<dyn Future<Output = Result<RequestId, FerrumError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Submit new inference request
Sourcefn next_batch<'life0, 'async_trait>(
&'life0 self,
hint: BatchHint,
) -> Pin<Box<dyn Future<Output = Option<BatchPlan>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn next_batch<'life0, 'async_trait>(
&'life0 self,
hint: BatchHint,
) -> Pin<Box<dyn Future<Output = Option<BatchPlan>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Get next batch of requests to execute
Sourcefn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
request_id: RequestId,
response: &'life1 InferenceResponse,
) -> Pin<Box<dyn Future<Output = Result<(), FerrumError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
request_id: RequestId,
response: &'life1 InferenceResponse,
) -> Pin<Box<dyn Future<Output = Result<(), FerrumError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Mark request as completed
Sourcefn cancel<'life0, 'async_trait>(
&'life0 self,
request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<bool, FerrumError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn cancel<'life0, 'async_trait>(
&'life0 self,
request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<bool, FerrumError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Cancel pending request
Sourcefn update_priority<'life0, 'async_trait>(
&'life0 self,
request_id: RequestId,
priority: Priority,
) -> Pin<Box<dyn Future<Output = Result<(), FerrumError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn update_priority<'life0, 'async_trait>(
&'life0 self,
request_id: RequestId,
priority: Priority,
) -> Pin<Box<dyn Future<Output = Result<(), FerrumError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Update request priority
Sourcefn metrics(&self) -> SchedulerStats
fn metrics(&self) -> SchedulerStats
Get scheduler metrics
Sourcefn config(&self) -> &SchedulerConfig
fn config(&self) -> &SchedulerConfig
Get scheduler configuration
Provided Methods§
Sourcefn request_state(&self, request_id: &RequestId) -> Option<RequestState>
fn request_state(&self, request_id: &RequestId) -> Option<RequestState>
Get current request state if the request is tracked by scheduler.
Sourcefn preempt<'life0, 'async_trait>(
&'life0 self,
_request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<PreemptionResult, FerrumError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn preempt<'life0, 'async_trait>(
&'life0 self,
_request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<PreemptionResult, FerrumError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Preempt running request (if supported)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".