Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ queuectl – Redis‑Backed Background Job Queue (CLI Tool)

queuectl is a lightweight, CLI‑based background job queue system inspired by BullMQ, RQ, and Celery β€” built entirely in Python with Redis for persistence.

It provides a simple CLI workflow while supporting advanced background job processing features.


πŸŽ₯ Demo Video

πŸ“¦ Features

βœ” Background Jobs

Enqueue and execute shell commands as jobs via a clean CLI.

βœ” Multi‑Process Workers

Scale by running multiple workers in parallel.

βœ” Redis Storage

All job metadata and queue state are stored in Redis:

  • LIST β†’ pending queue
  • ZSET β†’ delayed jobs
  • LIST β†’ DLQ (dead letter queue)
  • HASH β†’ job metadata

βœ” Automatic Retries

Failed jobs retry using exponential backoff:

delay = backoff_base ** attempts

βœ” Delayed Jobs & Scheduler

Delayed jobs are stored in a Redis ZSET and moved back to pending when run_at is reached.

βœ” Dead Letter Queue

After exceeding max_retries, jobs move to DLQ.

βœ” Configurable

Settings include:

  • max_retries
  • backoff_base
  • And more via configuration API.

πŸ“ Project Structure

The project is organized into three major components:

1. queuectl/ β€” Core Queue Engine (Python + Redis)

Contains everything related to the queueing system: workers, scheduler, storage, CLI, and Redis integration.

queuectl/
β”‚
β”œβ”€β”€ pyproject.toml
β”‚
└── queuectl/
    β”œβ”€β”€ __init__.py
    β”œβ”€β”€ main.py                # CLI entrypoint (queuectl command)
    β”œβ”€β”€ cli.py                 # Command parsing & routing
    β”œβ”€β”€ storage.py             # Redis job storage & transitions
    β”œβ”€β”€ worker.py              # Worker processes & manager
    β”œβ”€β”€ scheduler.py           # Delayed job scheduler
    β”œβ”€β”€ redisConnection.py     # Redis connection wrapper
    β”œβ”€β”€ config.py              # Global configuration handler
    β”œβ”€β”€ models.py              # Job dataclass
    β”œβ”€β”€ jobState.py            # Job state constants
    β”œβ”€β”€ dlq.py                 # Dead Letter Queue operations
    └── data/                  # Runtime config + metadata

2. server/ β€” FastAPI Monitoring Backend

This module provides APIs for the dashboard and external integrations. It reads data only from Redis (no direct connection to workers).

server/
β”‚
└── app.py                    # FastAPI server

Responsibilities:

  • Serve job lists (pending, processing, completed, dead)
  • Serve metrics/summary (/stats)
  • Track worker processes
  • Provide DLQ operations
  • Act as backend for the React dashboard

3. web-dashboard/ β€” React Dashboard (Queue Monitoring UI)

A modern dashboard for real‑time visibility into queue status.

web-dashboard/
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”œβ”€β”€ public/
└── package.json

Dashboard provides:

  • Overview cards (Pending, Processing, Completed, Dead)
  • Worker list with PID, start time, live status
  • Job list with filters (state-wise)
  • Auto-refresh and manual refresh
  • Color-coded job states (PENDING, PROCESSING, COMPLETED, DEAD)

πŸ›  Installation

1. Install Redis

redis-server

2. Install queuectl in editable mode

Navigate to the project root:

pip install -e .

This installs the queuectl command globally.


πŸ§ͺ Quickstart

β–Ά Enqueue a Job

queuectl enqueue --command "echo hello"

β–Ά View Jobs

queuectl list
queuectl list --state PENDING
queuectl list --state COMPLETED

β–Ά Start Workers

queuectl worker start --count 3

β–Ά Stop Workers

queuectl worker stop

πŸ” Retry Logic

Jobs retry automatically using exponential backoff.

Attempt Delay
1 2s
2 4s
3 8s

You can configure retry behavior:

queuectl config set backoff_base 3
queuectl config set max_retries 5

⏳ Delayed & Scheduled Jobs

Failed jobs or scheduled jobs are placed in:

queuectl:queue:delayed

The scheduler reads this ZSET and moves ready jobs into the pending queue.

Scheduler starts automatically with workers.


πŸ’€ Dead Letter Queue

Jobs that exhaust retries move to DLQ.

View DLQ

queuectl dlq list

Retry a DLQ job

queuectl dlq retry <job_id>

βš™οΈ Configuration

queuectl config set max_retries 5
queuectl config set backoff_base 3

Config is stored under:

queuectl/data/config.json

Code Style

Use any formatter (Black, Ruff, etc.).


🀝 Contributing

Contributions are welcome!

You can help by:

  • Fixing bugs
  • Adding features (timeouts, priority queues, metrics)
  • Improving dashboard UI
  • Enhancing documentation

πŸ“œ License

MIT License


⭐ Support

If you find this project useful, consider giving it a ⭐ on GitHub!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages