rename worker to actor

This commit is contained in:
Timur Gordon
2025-08-05 15:44:33 +02:00
parent 5283f383b3
commit 89e953ca1d
67 changed files with 1629 additions and 1737 deletions

View File

@@ -25,20 +25,20 @@ Where config is toml file with the following structure:
[global]
redis_url = "redis://localhost:6379"
[osis_worker]
binary_path = "/path/to/osis_worker"
[osis_actor]
binary_path = "/path/to/osis_actor"
env_vars = { "VAR1" = "value1", "VAR2" = "value2" }
[sal_worker]
binary_path = "/path/to/sal_worker"
[sal_actor]
binary_path = "/path/to/sal_actor"
env_vars = { "VAR1" = "value1", "VAR2" = "value2" }
[v_worker]
binary_path = "/path/to/v_worker"
[v_actor]
binary_path = "/path/to/v_actor"
env_vars = { "VAR1" = "value1", "VAR2" = "value2" }
[python_worker]
binary_path = "/path/to/python_worker"
[python_actor]
binary_path = "/path/to/python_actor"
env_vars = { "VAR1" = "value1", "VAR2" = "value2" }
```
@@ -46,7 +46,7 @@ env_vars = { "VAR1" = "value1", "VAR2" = "value2" }
Lets have verbosity settings etc.
CLI Offers a few commands:
workers:
actors:
start
stop
restart
@@ -63,4 +63,4 @@ jobs:
logs
list
repl: you can enter interactive mode to run scripts, however predefine caller_id, context_id and worker type so supervisor dispathces jobs accordingly
repl: you can enter interactive mode to run scripts, however predefine caller_id, context_id and actor type so supervisor dispathces jobs accordingly

View File

@@ -43,7 +43,7 @@ struct Args {
struct Config {
global: GlobalConfig,
#[serde(flatten)]
workers: std::collections::HashMap<String, WorkerConfigToml>,
actors: std::collections::HashMap<String, ActorConfigToml>,
}
#[derive(Debug, Deserialize)]
@@ -52,7 +52,7 @@ struct GlobalConfig {
}
#[derive(Debug, Deserialize)]
struct WorkerConfigToml {
struct ActorConfigToml {
binary_path: String,
env_vars: Option<std::collections::HashMap<String, String>>,
}
@@ -60,20 +60,20 @@ struct WorkerConfigToml {
#[derive(Debug, Clone, PartialEq)]
enum TabId {
Dashboard,
Workers,
Actors,
Jobs,
Logs,
}
impl TabId {
fn all() -> Vec<TabId> {
vec![TabId::Dashboard, TabId::Workers, TabId::Jobs, TabId::Logs]
vec![TabId::Dashboard, TabId::Actors, TabId::Jobs, TabId::Logs]
}
fn title(&self) -> &str {
match self {
TabId::Dashboard => "Dashboard",
TabId::Workers => "Workers",
TabId::Actors => "Actors",
TabId::Jobs => "Jobs",
TabId::Logs => "Logs",
}
@@ -167,7 +167,7 @@ fn render_ui(f: &mut Frame, app: &mut App) {
// Render content based on selected tab
match app.current_tab {
TabId::Dashboard => render_dashboard(f, chunks[1], app),
TabId::Workers => render_workers(f, chunks[1], app),
TabId::Actors => render_actors(f, chunks[1], app),
TabId::Jobs => render_jobs(f, chunks[1], app),
TabId::Logs => render_logs(f, chunks[1], app),
}
@@ -180,7 +180,7 @@ fn render_dashboard(f: &mut Frame, area: Rect, app: &App) {
.split(area);
// Status overview - supervisor is already running if we get here
let status_text = "Status: ✓ Running\nWorkers: Started successfully\nJobs: Ready for processing\n\nPress 'q' to quit, Tab to navigate";
let status_text = "Status: ✓ Running\nActors: Started successfully\nJobs: Ready for processing\n\nPress 'q' to quit, Tab to navigate";
let status_paragraph = Paragraph::new(status_text)
.block(Block::default().borders(Borders::ALL).title("System Status"))
@@ -202,9 +202,9 @@ fn render_dashboard(f: &mut Frame, area: Rect, app: &App) {
f.render_widget(logs_list, chunks[1]);
}
fn render_workers(f: &mut Frame, area: Rect, _app: &App) {
let paragraph = Paragraph::new("Workers tab - Status checking not implemented yet to avoid system issues")
.block(Block::default().borders(Borders::ALL).title("Workers"))
fn render_actors(f: &mut Frame, area: Rect, _app: &App) {
let paragraph = Paragraph::new("Actors tab - Status checking not implemented yet to avoid system issues")
.block(Block::default().borders(Borders::ALL).title("Actors"))
.wrap(Wrap { trim: true });
f.render_widget(paragraph, area);
@@ -305,18 +305,18 @@ async fn main() -> Result<()> {
let mut builder = SupervisorBuilder::new()
.redis_url(&config.global.redis_url);
for (worker_name, worker_config) in &config.workers {
match worker_name.as_str() {
"osis_worker" => builder = builder.osis_worker(&worker_config.binary_path),
"sal_worker" => builder = builder.sal_worker(&worker_config.binary_path),
"v_worker" => builder = builder.v_worker(&worker_config.binary_path),
"python_worker" => builder = builder.python_worker(&worker_config.binary_path),
_ => log::warn!("Unknown worker type: {}", worker_name),
for (actor_name, actor_config) in &config.actors {
match actor_name.as_str() {
"osis_actor" => builder = builder.osis_actor(&actor_config.binary_path),
"sal_actor" => builder = builder.sal_actor(&actor_config.binary_path),
"v_actor" => builder = builder.v_actor(&actor_config.binary_path),
"python_actor" => builder = builder.python_actor(&actor_config.binary_path),
_ => log::warn!("Unknown actor type: {}", actor_name),
}
if let Some(env_vars) = &worker_config.env_vars {
if let Some(env_vars) = &actor_config.env_vars {
for (key, value) in env_vars {
builder = builder.worker_env_var(key, value);
builder = builder.actor_env_var(key, value);
}
}
}
@@ -325,11 +325,11 @@ async fn main() -> Result<()> {
.map_err(|e| anyhow::anyhow!("Failed to build supervisor: {}", e))?);
info!("✓ Supervisor built successfully");
// Step 4: Start supervisor and workers
info!("Step 4/4: Starting supervisor and workers...");
supervisor.start_workers().await
.map_err(|e| anyhow::anyhow!("Failed to start workers: {}", e))?;
info!("✓ All workers started successfully");
// Step 4: Start supervisor and actors
info!("Step 4/4: Starting supervisor and actors...");
supervisor.start_actors().await
.map_err(|e| anyhow::anyhow!("Failed to start actors: {}", e))?;
info!("✓ All actors started successfully");
// All initialization successful - now start TUI
info!("Initialization complete - starting TUI...");

View File

@@ -73,7 +73,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Validate script type
match args.script_type.to_lowercase().as_str() {
"osis" | "sal" | "v" | "python" => {
// Valid script types - no worker validation needed since we use hardcoded queues
// Valid script types - no actor validation needed since we use hardcoded queues
}
_ => {
error!("❌ Invalid script type: {}. Valid types: osis, sal, v, python", args.script_type);
@@ -89,7 +89,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
info!(" Script Type: {}", args.script_type);
info!(" Redis URL: {}", args.redis_url);
info!(" Timeout: {}s", args.timeout);
info!(" Using hardcoded worker queues for script type: {}", args.script_type);
info!(" Using hardcoded actor queues for script type: {}", args.script_type);
info!("");
}