mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-18 14:44:21 +01:00
add scheduler type setting (#3119)
This commit is contained in:
@@ -856,6 +856,11 @@ pub async fn configure_settings_dialog() -> Result<(), Box<dyn Error>> {
|
|||||||
"Goose recipe github repo",
|
"Goose recipe github repo",
|
||||||
"Goose will pull recipes from this repo if not found locally.",
|
"Goose will pull recipes from this repo if not found locally.",
|
||||||
)
|
)
|
||||||
|
.item(
|
||||||
|
"scheduler",
|
||||||
|
"Scheduler Type",
|
||||||
|
"Choose between built-in cron scheduler or Temporal workflow engine",
|
||||||
|
)
|
||||||
.interact()?;
|
.interact()?;
|
||||||
|
|
||||||
match setting_type {
|
match setting_type {
|
||||||
@@ -877,6 +882,9 @@ pub async fn configure_settings_dialog() -> Result<(), Box<dyn Error>> {
|
|||||||
"recipe" => {
|
"recipe" => {
|
||||||
configure_recipe_dialog()?;
|
configure_recipe_dialog()?;
|
||||||
}
|
}
|
||||||
|
"scheduler" => {
|
||||||
|
configure_scheduler_dialog()?;
|
||||||
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1227,3 +1235,57 @@ fn configure_recipe_dialog() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn configure_scheduler_dialog() -> Result<(), Box<dyn Error>> {
|
||||||
|
let config = Config::global();
|
||||||
|
|
||||||
|
// Check if GOOSE_SCHEDULER_TYPE is set as an environment variable
|
||||||
|
if std::env::var("GOOSE_SCHEDULER_TYPE").is_ok() {
|
||||||
|
let _ = cliclack::log::info("Notice: GOOSE_SCHEDULER_TYPE environment variable is set and will override the configuration here.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get current scheduler type from config for display
|
||||||
|
let current_scheduler: String = config
|
||||||
|
.get_param("GOOSE_SCHEDULER_TYPE")
|
||||||
|
.unwrap_or_else(|_| "legacy".to_string());
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"Current scheduler type: {}",
|
||||||
|
style(¤t_scheduler).cyan()
|
||||||
|
);
|
||||||
|
|
||||||
|
let scheduler_type = cliclack::select("Which scheduler type would you like to use?")
|
||||||
|
.items(&[
|
||||||
|
("legacy", "Built-in Cron (Default)", "Uses Goose's built-in cron scheduler. Simple and reliable for basic scheduling needs."),
|
||||||
|
("temporal", "Temporal", "Uses Temporal workflow engine for advanced scheduling features. Requires Temporal CLI to be installed.")
|
||||||
|
])
|
||||||
|
.interact()?;
|
||||||
|
|
||||||
|
match scheduler_type {
|
||||||
|
"legacy" => {
|
||||||
|
config.set_param("GOOSE_SCHEDULER_TYPE", Value::String("legacy".to_string()))?;
|
||||||
|
cliclack::outro(
|
||||||
|
"Set to Built-in Cron scheduler - simple and reliable for basic scheduling",
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
"temporal" => {
|
||||||
|
config.set_param(
|
||||||
|
"GOOSE_SCHEDULER_TYPE",
|
||||||
|
Value::String("temporal".to_string()),
|
||||||
|
)?;
|
||||||
|
cliclack::outro(
|
||||||
|
"Set to Temporal scheduler - advanced workflow engine for complex scheduling",
|
||||||
|
)?;
|
||||||
|
println!();
|
||||||
|
println!("📋 {}", style("Note:").bold());
|
||||||
|
println!(" • Temporal scheduler requires Temporal CLI to be installed");
|
||||||
|
println!(" • macOS: brew install temporal");
|
||||||
|
println!(" • Linux/Windows: https://github.com/temporalio/cli/releases");
|
||||||
|
println!(" • If Temporal is unavailable, Goose will automatically fall back to the built-in scheduler");
|
||||||
|
println!(" • The scheduling engines do not share the list of schedules");
|
||||||
|
}
|
||||||
|
_ => unreachable!(),
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user