pub struct BackgroundExecutor { /* private fields */ }Expand description
Manages background gorilla tasks that run autonomously on schedules.
Implementations§
Source§impl BackgroundExecutor
impl BackgroundExecutor
Sourcepub fn with_shutdown(
shutdown_tx: Sender<bool>,
shutdown_rx: Receiver<bool>,
) -> Self
pub fn with_shutdown( shutdown_tx: Sender<bool>, shutdown_rx: Receiver<bool>, ) -> Self
Create a new background executor with a custom shutdown channel.
Sourcepub fn parse_schedule(schedule: &str) -> Option<Duration>
pub fn parse_schedule(schedule: &str) -> Option<Duration>
Parse a schedule string into a std::time::Duration.
Supported formats:
- Human-friendly:
"every 30s","every 5m","every 1h","every 1d" - Cron expressions:
"*/30 * * * *"(every 30 min),"0 */6 * * *"(every 6h) - Raw seconds:
"60"
Sourcepub fn start_gorilla(
&self,
id: GorillaId,
manifest: GorillaManifest,
default_model: ModelConfig,
memory: Arc<MemorySubstrate>,
driver: Arc<dyn LlmDriver>,
) -> PunchResult<()>
pub fn start_gorilla( &self, id: GorillaId, manifest: GorillaManifest, default_model: ModelConfig, memory: Arc<MemorySubstrate>, driver: Arc<dyn LlmDriver>, ) -> PunchResult<()>
Start a gorilla’s autonomous background task.
The task will loop on the gorilla’s schedule, acquiring the LLM semaphore before each run, and executing the fighter loop with an autonomous prompt derived from the gorilla’s manifest.
default_model is used as a fallback when the gorilla manifest does
not specify its own model configuration.
Sourcepub fn stop_gorilla(&self, id: &GorillaId) -> bool
pub fn stop_gorilla(&self, id: &GorillaId) -> bool
Stop a gorilla’s background task by aborting it.
Sourcepub fn is_running(&self, id: &GorillaId) -> bool
pub fn is_running(&self, id: &GorillaId) -> bool
Check whether a gorilla is currently running.
Sourcepub fn list_running(&self) -> Vec<GorillaId>
pub fn list_running(&self) -> Vec<GorillaId>
List all currently running gorilla IDs.
Sourcepub fn shutdown_all(&self)
pub fn shutdown_all(&self)
Shutdown all running gorilla tasks.
Sourcepub fn running_count(&self) -> usize
pub fn running_count(&self) -> usize
Returns the number of currently running gorilla tasks.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BackgroundExecutor
impl !RefUnwindSafe for BackgroundExecutor
impl Send for BackgroundExecutor
impl Sync for BackgroundExecutor
impl Unpin for BackgroundExecutor
impl UnsafeUnpin for BackgroundExecutor
impl !UnwindSafe for BackgroundExecutor
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
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>
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>
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