pub struct ModelServingManager { /* private fields */ }Expand description
Model serving manager
Implementations§
Source§impl ModelServingManager
impl ModelServingManager
Sourcepub fn new(config: ServingConfig) -> Self
pub fn new(config: ServingConfig) -> Self
Create a new model serving manager
Sourcepub fn with_model<M: Model<Input = Tensor, Output = Tensor> + 'static>(
config: ServingConfig,
model: M,
) -> Self
pub fn with_model<M: Model<Input = Tensor, Output = Tensor> + 'static>( config: ServingConfig, model: M, ) -> Self
Create a new model serving manager with a specific model
Sourcepub fn set_inference_fn(&mut self, inference_fn: ModelInferenceFn)
pub fn set_inference_fn(&mut self, inference_fn: ModelInferenceFn)
Set a custom inference function
Sourcepub fn add_instance(&self, instance: ModelInstance) -> Result<()>
pub fn add_instance(&self, instance: ModelInstance) -> Result<()>
Add a model instance
Sourcepub fn get_health_status(&self) -> Result<HashMap<String, CircuitBreakerState>>
pub fn get_health_status(&self) -> Result<HashMap<String, CircuitBreakerState>>
Get health status for all instances
Sourcepub async fn perform_health_check(&self) -> Result<()>
pub async fn perform_health_check(&self) -> Result<()>
Perform health check on all instances
Sourcepub async fn submit_request(&self, request: InferenceRequest) -> Result<()>
pub async fn submit_request(&self, request: InferenceRequest) -> Result<()>
Submit a request for processing
Sourcepub async fn process_next_request(&self) -> Result<Option<InferenceResponse>>
pub async fn process_next_request(&self) -> Result<Option<InferenceResponse>>
Process the next request in the queue
Sourcepub async fn get_metrics(&self) -> ServingMetrics
pub async fn get_metrics(&self) -> ServingMetrics
Get current serving metrics
Sourcepub async fn cleanup_expired_requests(&self) -> Result<usize>
pub async fn cleanup_expired_requests(&self) -> Result<usize>
Cleanup expired requests
Sourcepub fn healthy_instances_count(&self) -> Result<usize>
pub fn healthy_instances_count(&self) -> Result<usize>
Get healthy instances count
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelServingManager
impl !RefUnwindSafe for ModelServingManager
impl Send for ModelServingManager
impl Sync for ModelServingManager
impl Unpin for ModelServingManager
impl UnsafeUnpin for ModelServingManager
impl !UnwindSafe for ModelServingManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more