pub struct CronManager { /* private fields */ }Expand description
Cron manager for job scheduling and execution
Implementations§
Source§impl CronManager
impl CronManager
Sourcepub async fn new<P: AsRef<Path>>(workspace: P) -> Result<Self>
pub async fn new<P: AsRef<Path>>(workspace: P) -> Result<Self>
Create a new cron manager with file-based storage
Sourcepub fn with_store(store: Arc<dyn CronStore>, workspace: String) -> Self
pub fn with_store(store: Arc<dyn CronStore>, workspace: String) -> Self
Create a cron manager with a custom store
Sourcepub fn set_agent_executor(&mut self, executor: Arc<dyn AgentExecutor>)
pub fn set_agent_executor(&mut self, executor: Arc<dyn AgentExecutor>)
Set the agent executor for agent-mode cron jobs.
Sourcepub fn subscribe(&self) -> Receiver<SchedulerEvent>
pub fn subscribe(&self) -> Receiver<SchedulerEvent>
Subscribe to scheduler events
Sourcepub async fn add_job(
&self,
name: &str,
schedule: &str,
command: &str,
) -> Result<CronJob>
pub async fn add_job( &self, name: &str, schedule: &str, command: &str, ) -> Result<CronJob>
Add a new cron job
Sourcepub async fn add_agent_job(
&self,
name: &str,
schedule: &str,
prompt: &str,
config: AgentJobConfig,
) -> Result<CronJob>
pub async fn add_agent_job( &self, name: &str, schedule: &str, prompt: &str, config: AgentJobConfig, ) -> Result<CronJob>
Add a new agent-mode cron job.
The command field is used as the agent prompt. When the job fires,
it creates a temporary Agent with the given config and sends the prompt.
Sourcepub async fn update_job(
&self,
id: &str,
schedule: Option<&str>,
command: Option<&str>,
timeout_ms: Option<u64>,
) -> Result<CronJob>
pub async fn update_job( &self, id: &str, schedule: Option<&str>, command: Option<&str>, timeout_ms: Option<u64>, ) -> Result<CronJob>
Update a job
Sourcepub async fn resume_job(&self, id: &str) -> Result<CronJob>
pub async fn resume_job(&self, id: &str) -> Result<CronJob>
Resume a paused job
Sourcepub async fn remove_job(&self, id: &str) -> Result<()>
pub async fn remove_job(&self, id: &str) -> Result<()>
Remove a job
Sourcepub async fn get_history(
&self,
job_id: &str,
limit: usize,
) -> Result<Vec<JobExecution>>
pub async fn get_history( &self, job_id: &str, limit: usize, ) -> Result<Vec<JobExecution>>
Get execution history for a job
Sourcepub async fn run_job(&self, id: &str) -> Result<JobExecution>
pub async fn run_job(&self, id: &str) -> Result<JobExecution>
Manually run a job
Sourcepub async fn is_running(&self) -> bool
pub async fn is_running(&self) -> bool
Check if scheduler is running
Auto Trait Implementations§
impl Freeze for CronManager
impl !RefUnwindSafe for CronManager
impl Send for CronManager
impl Sync for CronManager
impl Unpin for CronManager
impl UnsafeUnpin for CronManager
impl !UnwindSafe for CronManager
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