Celery task queues
This document covers inspecting and managing Celery task queues in the deployed Packit service.
Queue overview
The service uses three Celery queues:
short-running- default queue for quick taskslong-running- for operations requiring running local commands/sandcastle use (builds, sync-release)rate-limited- for tasks re-queued due to API rate limits
Tasks are stored in Valkey (Redis-compatible) database. All tasks use
acks_late=True,
meaning tasks are acknowledged after completion. This means in-flight tasks
have their messages tracked in Valkey until the worker finishes processing them.
Inspecting queue size and content
Using Flower (Web UI)
Flower is deployed for monitoring Celery workers and tasks. It's exposed as a Service (not a Route), so you need to port-forward to access it:
$ oc port-forward svc/flower 5555:5555
Then open http://localhost:5555 in your browser.
Flower shows:
- Active, processed, and failed tasks
- Worker status and statistics
- Task details and results
See Flower documentation for more details.
Using Celery inspect commands
You can also use Celery's built-in inspection to see active/scheduled tasks:
$ oc exec packit-worker-short-running-0 -- celery -A packit_service.worker.tasks inspect active
$ oc exec packit-worker-short-running-0 -- celery -A packit_service.worker.tasks inspect reserved
$ oc exec packit-worker-short-running-0 -- celery -A packit_service.worker.tasks inspect scheduled
See Celery Workers Guide - Inspecting workers for more inspection commands.
Purging the task queue
After a long outage, the task queue may accumulate too many stale tasks that no longer make sense to process. This section describes how to safely purge the queue.
Purging while workers are actively processing tasks can cause issues - workers may fail to acknowledge completed tasks, potentially leading to duplicate processing on restart.
You should also notify users in the public channels that it is required to manually retrigger the jobs via comments.
Safe purge
Optionally scale down workers to reduce the number of prefetched tasks:
$ oc scale statefulset/packit-worker-short-running --replicas=0
$ oc scale statefulset/packit-worker-long-running --replicas=1Purge the queues using Celery's built-in
purgecommand. This can be run from any worker pod and will purge all queues:$ oc exec packit-worker-long-running-0 -- celery -A packit_service.worker.tasks purge -Q short-running,long-running,rate-limitedUsing
-fflag skips the confirmation prompt. With-Qyou can also specify only subset of queues.Scale workers back up (if scaled down):
$ oc scale statefulset/packit-worker-short-running --replicas=<N>
$ oc scale statefulset/packit-worker-long-running --replicas=<N>