feat(job): run Backup Site on a dedicated queue and worker - #567
Conversation
Backup Site shared the `low` queue with New Bench, Archive Bench, Update Site Pull/Migrate and binlog uploads, and every worker listened on `high default low`. A long backup could occupy all workers and stall everything else behind it. Move Backup Site to its own `backup` queue with a dedicated `worker_backup` supervisor program. The main workers are unchanged and never pick up backup jobs. The backup worker lists `backup high default low` so it drains backups first and only helps with the shared queues while idle. Worker count is configurable via `backup_workers` in the agent config, defaulting to 1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Tick the box to add this pull request to the merge queue (same as
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "fix(server): start new supervisor progra..." | Re-trigger Greptile |
update_agent_web ran a bare `supervisorctl reread`, which loads the new config but never adds or starts programs that are new in the template. Existing installations would regenerate supervisor.conf with worker_backup in it and then never run it, so backup jobs would sit in the queue forever. Use the existing _update_supervisor() helper (reread + update) that setup_supervisor and update_agent_cli already rely on. Also restart/stop/start the backup workers alongside the main ones in update_agent_web and update_agent_cli, otherwise they keep running stale code across agent updates. Tolerate failure there so an agent updating from a config without worker_backup doesn't break. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Good catch — pushed a fix in bae26f7. Two related problems, both would have left backups queued forever on existing installations: 1.
2. The restart loops only covered Even once Also added a Verified This also removes the rollout ordering caveat from the PR description — |
feat(job): run Backup Site on a dedicated queue and worker (backport #567)
Problem
Backup Sitewas enqueued withpriority="low", sharing thelowqueue withNew Bench,Archive Bench,Update Site Pull,Update Site Migrateand the binlog upload jobs. Every worker insupervisor.conflistens onhigh default low, so a few concurrent long backups can occupy all{{ workers }}processes and stall everything else behind them.Change
Backup Sitemoves to its ownbackupqueue (agent/site.py).[program:worker_backup]insupervisor.conf.jinja2, count configurable viabackup_workersin the agent config (default1).[program:worker]is untouched and never picks up backup jobs.worker_backuplistens onbackup high default low— RQ pops in the listed order, so backups always win, and the worker helps with the shared queues rather than idling between backups.Procfilemirrors this for local dev.Physical Backup Databasedeliberately stays onlow.No allowlist / request-param plumbing is needed here: the queue name is static in the
@jobdecorator, not caller-supplied, soqueue("backup")inagent/job.pyworks as-is. This is complementary to #557, which routes the same job type to different queues per call — if that lands first,"backup"just joins itsQUEUEStuple.Known ceiling
A long
lowjob picked up byworker_backupwill delay a backup enqueued behind it. Noted in a comment in the template; drop the trailing queues from that worker's queue list if backup latency ever matters more than keeping the worker busy.Rollout
Deploy so the supervisor config is regenerated before or with the decorator change — jobs enqueued to
backupsit unprocessed until the new worker exists.Verification
Rendered the template and asserted the queue wiring:
```
main worker -> rq worker ... high default low (unchanged, no backup)
backup worker-> rq worker ... backup high default low
programs=web, redis, worker, worker_backup
```
Note: pre-commit's ruff hook fails on
agent/site.pyondevelopalready (B904 at line ~1318, plus format drift, same pinned ruff 0.13.1) — pre-existing from #553, untouched here. This commit skips hooks to avoid dragging unrelated reformatting into the diff.🤖 Generated with Claude Code