Production deployment with zinit config
This commit is contained in:
@@ -54,6 +54,12 @@ impl SupervisorApp {
|
||||
|
||||
/// Start the Mycelium integration
|
||||
async fn start_mycelium_integration(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Skip Mycelium if URL is empty
|
||||
if self.mycelium_url.is_empty() {
|
||||
info!("Mycelium integration disabled (no URL provided)");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
info!("Starting Mycelium integration...");
|
||||
|
||||
let supervisor_for_mycelium = Arc::new(Mutex::new(self.supervisor.clone()));
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Re-export job types from the separate job crate
|
||||
pub use hero_job::*;
|
||||
// Re-export job types from the runner_rust crate
|
||||
pub use runner_rust::{Job, JobBuilder, JobStatus, JobError, Client, ClientBuilder};
|
||||
|
||||
@@ -13,7 +13,6 @@ pub mod mycelium;
|
||||
pub use runner::{Runner, RunnerConfig, RunnerResult, RunnerStatus};
|
||||
// pub use sal_service_manager::{ProcessManager, SimpleProcessManager, TmuxProcessManager};
|
||||
pub use supervisor::{Supervisor, SupervisorBuilder, ProcessManagerType};
|
||||
pub use hero_job::{Job, JobBuilder, JobStatus, JobError};
|
||||
pub use hero_job::Client;
|
||||
pub use runner_rust::{Job, JobBuilder, JobStatus, JobError, Client, ClientBuilder};
|
||||
pub use app::SupervisorApp;
|
||||
pub use mycelium::{MyceliumIntegration, MyceliumServer};
|
||||
|
||||
@@ -68,6 +68,8 @@ pub struct Runner {
|
||||
pub command: PathBuf, // Command to run runner by, used only if supervisor is used to run runners
|
||||
/// Redis URL for job queue
|
||||
pub redis_url: String,
|
||||
/// Additional command-line arguments
|
||||
pub extra_args: Vec<String>,
|
||||
}
|
||||
|
||||
impl Runner {
|
||||
@@ -79,6 +81,7 @@ impl Runner {
|
||||
namespace: config.namespace,
|
||||
command: config.command,
|
||||
redis_url: config.redis_url,
|
||||
extra_args: config.extra_args,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +99,26 @@ impl Runner {
|
||||
namespace,
|
||||
command,
|
||||
redis_url,
|
||||
extra_args: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new runner with extra arguments
|
||||
pub fn with_args(
|
||||
id: String,
|
||||
name: String,
|
||||
namespace: String,
|
||||
command: PathBuf,
|
||||
redis_url: String,
|
||||
extra_args: Vec<String>,
|
||||
) -> Self {
|
||||
Self {
|
||||
id,
|
||||
name,
|
||||
namespace,
|
||||
command,
|
||||
redis_url,
|
||||
extra_args,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +186,7 @@ pub enum RunnerError {
|
||||
#[error("Job error: {source}")]
|
||||
JobError {
|
||||
#[from]
|
||||
source: hero_job::JobError,
|
||||
source: runner_rust::JobError,
|
||||
},
|
||||
|
||||
#[error("Job '{job_id}' not found")]
|
||||
@@ -178,13 +201,15 @@ pub type RunnerConfig = Runner;
|
||||
|
||||
/// Convert Runner to ProcessConfig
|
||||
pub fn runner_to_process_config(config: &Runner) -> ProcessConfig {
|
||||
let args = vec![
|
||||
"--id".to_string(),
|
||||
config.id.clone(),
|
||||
let mut args = vec![
|
||||
config.id.clone(), // First positional argument is the runner ID
|
||||
"--redis-url".to_string(),
|
||||
config.redis_url.clone(),
|
||||
];
|
||||
|
||||
// Add extra arguments (e.g., context configurations)
|
||||
args.extend(config.extra_args.clone());
|
||||
|
||||
ProcessConfig::new(
|
||||
config.command.to_string_lossy().to_string(),
|
||||
args,
|
||||
|
||||
@@ -75,7 +75,7 @@ use tokio::sync::Mutex;
|
||||
// use sal_service_manager::{ProcessManager, SimpleProcessManager, TmuxProcessManager};
|
||||
|
||||
use crate::{job::JobStatus, runner::{LogInfo, Runner, RunnerConfig, RunnerError, RunnerResult, RunnerStatus}};
|
||||
use hero_job::{Client, client::ClientBuilder};
|
||||
use runner_rust::{Client, ClientBuilder};
|
||||
|
||||
|
||||
/// Process manager type for a runner
|
||||
@@ -280,6 +280,7 @@ impl Supervisor {
|
||||
namespace: self.namespace.clone(),
|
||||
command: PathBuf::from("/tmp/mock_runner"), // Default path
|
||||
redis_url: "redis://localhost:6379".to_string(),
|
||||
extra_args: Vec::new(),
|
||||
};
|
||||
|
||||
// Add the runner using existing logic
|
||||
|
||||
Reference in New Issue
Block a user