Production deployment with zinit config
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user