add tests and fix job impl
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use actor_system::spawn_sync_runner;
|
||||
use runner_rust::{spawn_sync_runner, script_mode::execute_script_mode};
|
||||
use clap::Parser;
|
||||
use log::{error, info};
|
||||
use tokio::sync::mpsc;
|
||||
@@ -23,6 +23,10 @@ struct Args {
|
||||
/// Preserve tasks after completion
|
||||
#[arg(short, long, default_value_t = false)]
|
||||
preserve_tasks: bool,
|
||||
|
||||
/// Script to execute in single-job mode (optional)
|
||||
#[arg(short, long)]
|
||||
script: Option<String>,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
@@ -32,6 +36,30 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
|
||||
let args = Args::parse();
|
||||
|
||||
// Check if we're in script mode
|
||||
if let Some(script_content) = args.script {
|
||||
info!("Running in script mode with runner ID: {}", args.runner_id);
|
||||
|
||||
let result = execute_script_mode(
|
||||
&script_content,
|
||||
&args.runner_id,
|
||||
args.redis_url,
|
||||
std::time::Duration::from_secs(300), // Default timeout for OSIS
|
||||
create_osis_engine,
|
||||
).await;
|
||||
|
||||
match result {
|
||||
Ok(output) => {
|
||||
println!("Script execution result:\n{}", output);
|
||||
return Ok(());
|
||||
}
|
||||
Err(e) => {
|
||||
error!("Script execution failed: {}", e);
|
||||
return Err(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
info!("Starting OSIS Sync Runner with ID: {}", args.runner_id);
|
||||
info!("Database path: {}", args.db_path);
|
||||
info!("Redis URL: {}", args.redis_url);
|
||||
|
Reference in New Issue
Block a user