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

@@ -1,6 +1,6 @@
# Hero Supervisor CLI Example
This example demonstrates how to use the `hive-supervisor` CLI tool for managing workers and jobs in the Hero ecosystem.
This example demonstrates how to use the `hive-supervisor` CLI tool for managing actors and jobs in the Hero ecosystem.
## Prerequisites
@@ -19,20 +19,20 @@ This example demonstrates how to use the `hive-supervisor` CLI tool for managing
# Follow Zinit installation instructions for your platform
```
3. **Worker Binaries**: The configuration references worker binaries that need to be available:
- `/usr/local/bin/osis_worker`
- `/usr/local/bin/sal_worker`
- `/usr/local/bin/v_worker`
- `/usr/local/bin/python_worker`
3. **Actor Binaries**: The configuration references actor binaries that need to be available:
- `/usr/local/bin/osis_actor`
- `/usr/local/bin/sal_actor`
- `/usr/local/bin/v_actor`
- `/usr/local/bin/python_actor`
For testing purposes, you can create mock worker binaries or update the paths in `config.toml` to point to existing binaries.
For testing purposes, you can create mock actor binaries or update the paths in `config.toml` to point to existing binaries.
## Configuration
The `config.toml` file contains the supervisor configuration:
- **Global settings**: Redis URL and Zinit socket path
- **Worker configurations**: Binary paths and environment variables for each worker type
- **Actor configurations**: Binary paths and environment variables for each actor type
## Usage Examples
@@ -43,29 +43,29 @@ The `config.toml` file contains the supervisor configuration:
cargo build --bin hive-supervisor --release
```
### 2. Worker Management
### 2. Actor Management
```bash
# Show help
./target/release/hive-supervisor --config examples/cli/config.toml --help
# List all configured workers
./target/release/hive-supervisor --config examples/cli/config.toml workers list
# List all configured actors
./target/release/hive-supervisor --config examples/cli/config.toml actors list
# Start all workers
./target/release/hive-supervisor --config examples/cli/config.toml workers start
# Start all actors
./target/release/hive-supervisor --config examples/cli/config.toml actors start
# Start specific workers
./target/release/hive-supervisor --config examples/cli/config.toml workers start osis_worker sal_worker
# Start specific actors
./target/release/hive-supervisor --config examples/cli/config.toml actors start osis_actor sal_actor
# Check worker status
./target/release/hive-supervisor --config examples/cli/config.toml workers status
# Check actor status
./target/release/hive-supervisor --config examples/cli/config.toml actors status
# Stop all workers
./target/release/hive-supervisor --config examples/cli/config.toml workers stop
# Stop all actors
./target/release/hive-supervisor --config examples/cli/config.toml actors stop
# Restart specific worker
./target/release/hive-supervisor --config examples/cli/config.toml workers restart osis_worker
# Restart specific actor
./target/release/hive-supervisor --config examples/cli/config.toml actors restart osis_actor
```
### 3. Job Management
@@ -73,7 +73,7 @@ cargo build --bin hive-supervisor --release
```bash
# Create a job with inline script
./target/release/hive-supervisor --config examples/cli/config.toml jobs create \
--script 'print("Hello from OSIS worker!");' \
--script 'print("Hello from OSIS actor!");' \
--script-type osis \
--caller-id "user123" \
--context-id "session456"
@@ -118,18 +118,18 @@ cargo build --bin hive-supervisor --release
```bash
# Enable debug logging
./target/release/hive-supervisor --config examples/cli/config.toml -v workers status
./target/release/hive-supervisor --config examples/cli/config.toml -v actors status
# Enable trace logging
./target/release/hive-supervisor --config examples/cli/config.toml -vv workers status
./target/release/hive-supervisor --config examples/cli/config.toml -vv actors status
# Disable timestamps
./target/release/hive-supervisor --config examples/cli/config.toml --no-timestamp workers status
./target/release/hive-supervisor --config examples/cli/config.toml --no-timestamp actors status
```
## Sample Scripts
The `sample_scripts/` directory contains example scripts for different worker types:
The `sample_scripts/` directory contains example scripts for different actor types:
- `hello_osis.rhai` - Simple OSIS/HeroScript example
- `system_sal.rhai` - SAL system operation example
@@ -148,9 +148,9 @@ The `sample_scripts/` directory contains example scripts for different worker ty
- Verify Zinit is running and the socket path is correct
- Check permissions on the socket file
3. **Worker Binary Not Found**
3. **Actor Binary Not Found**
- Update binary paths in `config.toml` to match your system
- Ensure worker binaries are executable
- Ensure actor binaries are executable
4. **Permission Denied**
- Check file permissions on configuration and binary files
@@ -161,7 +161,7 @@ The `sample_scripts/` directory contains example scripts for different worker ty
Run with verbose logging to see detailed operation information:
```bash
RUST_LOG=debug ./target/release/hive-supervisor --config examples/cli/config.toml -vv workers status
RUST_LOG=debug ./target/release/hive-supervisor --config examples/cli/config.toml -vv actors status
```
## Configuration Customization
@@ -170,15 +170,15 @@ You can customize the configuration for your environment:
1. **Update Redis URL**: Change `redis_url` in the `[global]` section
2. **Update Zinit Socket**: Change `zinit_socket_path` for your Zinit installation
3. **Worker Paths**: Update binary paths in worker sections to match your setup
4. **Environment Variables**: Add or modify environment variables for each worker type
3. **Actor Paths**: Update binary paths in actor sections to match your setup
4. **Environment Variables**: Add or modify environment variables for each actor type
## Integration with Hero Ecosystem
This CLI integrates with the broader Hero ecosystem:
- **Job Queue**: Uses Redis for job queuing and status tracking
- **Process Management**: Uses Zinit for worker lifecycle management
- **Process Management**: Uses Zinit for actor lifecycle management
- **Script Execution**: Supports multiple script types (OSIS, SAL, V, Python)
- **Monitoring**: Provides real-time status and logging capabilities