Fix: exclude platform_schedule_tool in CLI (#6442)
This commit is contained in:
@@ -4,6 +4,15 @@ use goose::scheduler::{
|
||||
SchedulerError,
|
||||
};
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
async fn create_scheduler() -> Result<Arc<Scheduler>> {
|
||||
let storage_path =
|
||||
get_default_scheduler_storage_path().context("Failed to get scheduler storage path")?;
|
||||
Scheduler::new(storage_path)
|
||||
.await
|
||||
.context("Failed to initialize scheduler")
|
||||
}
|
||||
|
||||
fn validate_cron_expression(cron: &str) -> Result<()> {
|
||||
// Basic validation and helpful suggestions
|
||||
@@ -88,11 +97,7 @@ pub async fn handle_schedule_add(
|
||||
process_start_time: None,
|
||||
};
|
||||
|
||||
let scheduler_storage_path =
|
||||
get_default_scheduler_storage_path().context("Failed to get scheduler storage path")?;
|
||||
let scheduler = Scheduler::new(scheduler_storage_path)
|
||||
.await
|
||||
.context("Failed to initialize scheduler")?;
|
||||
let scheduler = create_scheduler().await?;
|
||||
|
||||
match scheduler.add_scheduled_job(job, true).await {
|
||||
Ok(_) => {
|
||||
@@ -134,11 +139,7 @@ pub async fn handle_schedule_add(
|
||||
}
|
||||
|
||||
pub async fn handle_schedule_list() -> Result<()> {
|
||||
let scheduler_storage_path =
|
||||
get_default_scheduler_storage_path().context("Failed to get scheduler storage path")?;
|
||||
let scheduler = Scheduler::new(scheduler_storage_path)
|
||||
.await
|
||||
.context("Failed to initialize scheduler")?;
|
||||
let scheduler = create_scheduler().await?;
|
||||
|
||||
let jobs = scheduler.list_scheduled_jobs().await;
|
||||
if jobs.is_empty() {
|
||||
@@ -169,11 +170,7 @@ pub async fn handle_schedule_list() -> Result<()> {
|
||||
}
|
||||
|
||||
pub async fn handle_schedule_remove(schedule_id: String) -> Result<()> {
|
||||
let scheduler_storage_path =
|
||||
get_default_scheduler_storage_path().context("Failed to get scheduler storage path")?;
|
||||
let scheduler = Scheduler::new(scheduler_storage_path)
|
||||
.await
|
||||
.context("Failed to initialize scheduler")?;
|
||||
let scheduler = create_scheduler().await?;
|
||||
|
||||
match scheduler.remove_scheduled_job(&schedule_id, true).await {
|
||||
Ok(_) => {
|
||||
@@ -196,11 +193,7 @@ pub async fn handle_schedule_remove(schedule_id: String) -> Result<()> {
|
||||
}
|
||||
|
||||
pub async fn handle_schedule_sessions(schedule_id: String, limit: Option<usize>) -> Result<()> {
|
||||
let scheduler_storage_path =
|
||||
get_default_scheduler_storage_path().context("Failed to get scheduler storage path")?;
|
||||
let scheduler = Scheduler::new(scheduler_storage_path)
|
||||
.await
|
||||
.context("Failed to initialize scheduler")?;
|
||||
let scheduler = create_scheduler().await?;
|
||||
|
||||
match scheduler.sessions(&schedule_id, limit.unwrap_or(50)).await {
|
||||
Ok(sessions) => {
|
||||
@@ -232,11 +225,7 @@ pub async fn handle_schedule_sessions(schedule_id: String, limit: Option<usize>)
|
||||
}
|
||||
|
||||
pub async fn handle_schedule_run_now(schedule_id: String) -> Result<()> {
|
||||
let scheduler_storage_path =
|
||||
get_default_scheduler_storage_path().context("Failed to get scheduler storage path")?;
|
||||
let scheduler = Scheduler::new(scheduler_storage_path)
|
||||
.await
|
||||
.context("Failed to initialize scheduler")?;
|
||||
let scheduler = create_scheduler().await?;
|
||||
|
||||
match scheduler.run_now(&schedule_id).await {
|
||||
Ok(session_id) => {
|
||||
|
||||
Reference in New Issue
Block a user