pub struct ExecutorPool { /* private fields */ }Expand description
Pool of executors for a supervisor.
Implementations§
Source§impl ExecutorPool
impl ExecutorPool
Sourcepub fn new(
supervisor_id: impl Into<String>,
initial_size: usize,
) -> ExecutorPoolBuilder
pub fn new( supervisor_id: impl Into<String>, initial_size: usize, ) -> ExecutorPoolBuilder
Create a new pool.
§Example
let pool = ExecutorPool::new("sup-001", 4)
.llm_gemini("gemini-2.0-flash")
.build();Sourcepub async fn get_all_idle(&self) -> Vec<Arc<Executor>>
pub async fn get_all_idle(&self) -> Vec<Arc<Executor>>
Get all idle executors.
Sourcepub async fn idle_count(&self) -> usize
pub async fn idle_count(&self) -> usize
Get idle count.
Sourcepub async fn busy_count(&self) -> usize
pub async fn busy_count(&self) -> usize
Get busy count.
Sourcepub async fn utilization(&self) -> f32
pub async fn utilization(&self) -> f32
Get utilization (0.0-1.0).
Sourcepub async fn add_executor(&self) -> Arc<Executor>
pub async fn add_executor(&self) -> Arc<Executor>
Add a new executor to the pool.
Sourcepub async fn remove_idle(&self) -> Option<String>
pub async fn remove_idle(&self) -> Option<String>
Remove an idle executor.
Sourcepub async fn scale_down(&self, n: usize)
pub async fn scale_down(&self, n: usize)
Scale down by n executors.
Sourcepub async fn auto_scale(&self)
pub async fn auto_scale(&self)
Auto-scale based on utilization.
Sourcepub async fn executor_ids(&self) -> Vec<String>
pub async fn executor_ids(&self) -> Vec<String>
Get all executor IDs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExecutorPool
impl !RefUnwindSafe for ExecutorPool
impl Send for ExecutorPool
impl Sync for ExecutorPool
impl Unpin for ExecutorPool
impl UnsafeUnpin for ExecutorPool
impl !UnwindSafe for ExecutorPool
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