Module commands

Module commands 

Source
Expand description

CLI command implementations for CeleRS distributed task queue management.

This module provides all the command implementations for the CeleRS CLI tool. Commands are organized into the following categories:

  • Worker Management: Starting, stopping, pausing, scaling workers
  • Queue Operations: Listing, purging, moving, importing/exporting queues
  • Task Management: Inspecting, canceling, retrying, and monitoring tasks
  • DLQ Operations: Managing failed tasks in the Dead Letter Queue
  • Scheduling: Managing scheduled/periodic tasks with cron expressions
  • Monitoring: Metrics, dashboard, health checks, and diagnostics
  • Database: Connection testing, health checks, migrations
  • Configuration: Validation, initialization, and profile management

§Error Handling

All functions return anyhow::Result<()> for consistent error handling. Errors are user-friendly and provide actionable feedback.

§Examples

use celers_cli::commands;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Start a worker
    commands::start_worker(
        "redis://localhost:6379",
        "my_queue",
        "fifo",
        4,
        3,
        300
    ).await?;
    Ok(())
}

Functions§

add_schedule
Add a new scheduled task
alert_start
Start alert monitoring service
alert_test
Test webhook notification
analyze_bottlenecks
Analyze performance bottlenecks
analyze_failures
Analyze failure patterns
autoscale_start
Start auto-scaling service
autoscale_status
Show auto-scaling status
cancel_task
Cancel a running or pending task
clear_dlq
Clear Dead Letter Queue
db_health
Check database health
db_migrate
Run database migrations
db_pool_stats
Show connection pool statistics
db_test_connection
Test database connection
debug_task
Debug task execution details
debug_worker
Debug worker issues
doctor
Automatic problem detection and diagnostics
drain_worker
Drain worker (stop accepting new tasks)
export_queue
Export queue tasks to a JSON file
health_check
Run system health diagnostics
import_queue
Import queue tasks from a JSON file
init_config
Generate a default configuration file with template settings.
inspect_dlq
Inspect failed tasks in the Dead Letter Queue (DLQ).
inspect_task
Inspect a specific task by ID
list_queues
List all queues (Redis only)
list_schedules
List all scheduled tasks
list_workers
List all running workers
move_queue
Move all tasks from one queue to another
pause_queue
Pause queue processing
pause_schedule
Pause a schedule
pause_worker
Pause task processing for a worker
purge_queue
Purge all tasks from a queue
queue_stats
Show detailed queue statistics
remove_schedule
Remove a scheduled task
replay_task
Replay a task from DLQ
report_daily
Generate daily execution report
report_weekly
Generate weekly statistics report
requeue_task
Move task from one queue to another
resume_queue
Resume queue processing
resume_schedule
Resume a paused schedule
resume_worker
Resume task processing for a worker
retry_task
Retry a failed task (from any queue)
run_dashboard
Run interactive TUI dashboard for real-time monitoring
scale_workers
Scale workers to N instances
schedule_history
Show execution history for a schedule
show_metrics
Display Prometheus metrics
show_status
Display queue status and statistics.
show_task_logs
Show task execution logs
show_task_result
Show task result from backend
start_worker
Start a worker with the given configuration.
stop_worker
Stop a specific worker
trigger_schedule
Manually trigger a scheduled task
validate_config
Validate configuration file
worker_logs
Stream worker logs with optional filtering and follow mode
worker_stats
Show detailed statistics for a worker