A small, dependency-free job queue built on asyncio. It demonstrates bounded concurrency, retry policies, lifecycle management, job cancellation, and observable queue metrics.
Background work is a core building block in backend systems. This implementation focuses on graceful shutdown, exponential retry backoff, explicit state transitions, and testable concurrency limits.
- Configurable worker pool and bounded queue
- Exponential-backoff retries
- Job states, results, errors, and timestamps
- Graceful drain or immediate abort
- Cancellation of queued work
- Queue-level metrics
- Async context-manager API
python3 examples/demo.pypython3 -m unittest discover -s tests -vEach submitted job is stored separately from the internal queue, so callers can inspect immutable snapshots of state. Workers own state transitions, while per-job events provide efficient completion waiting without polling.