-
Notifications
You must be signed in to change notification settings - Fork 11
Set up RabbitMQ as Celery broker #1041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ac67395
feat: rabbitmq as celery broker, default antenna queue
vanessavmac c7b0380
Merge branch 'main' into feat/rabbitmq-broker
vanessavmac 9742263
feat: separate CI stack with rabbitmq
vanessavmac 249c058
Merge branch 'feat/rabbitmq-broker' of https://github.com/RolnickLab/…
vanessavmac 1c337cd
fix: broker url trailing slash, database url for CI stack
vanessavmac 53d13eb
Add missing CI changes
vanessavmac d8aa02d
Merge branch 'main' into feat/rabbitmq-broker
mihow 539fd35
chore: share env vars with django app
mihow 133515d
feat: move celery & debugbpy start command out of compose files
mihow edbd7d2
feat: update production compose file for rabbitmq & default queue
mihow efec9f3
chore: explain redundant DATABASE_URL env var
mihow e8d10ab
feat: use docker override file to activate debuggers
mihow bfc0c23
Merge branch 'main' into feat/rabbitmq-broker
mihow 82fdfd8
chore: tell agent docs we are using RabbitMQ instead of Redis now
mihow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,16 @@ Every call to the AI model API incurs a cost and requires electricity. Be smart | |
| - Always prefer command line tools to avoid expensive API requests (e.g., use git and jq instead of reading whole files) | ||
| - Use bulk operations and prefetch patterns to minimize database queries | ||
|
|
||
| **Performance Optimization:** | ||
| - django-cachalot handles automatic query caching - don't add manual caching layers on top | ||
| - Focus on optimizing cold queries first before adding caching | ||
| - When ordering by annotated fields, pagination COUNT queries include those annotations - use `.values('pk')` to strip them | ||
| - For large tables (>10k rows), consider fuzzy counting using PostgreSQL's pg_class.reltuples | ||
|
|
||
| **Git Commit Guidelines:** | ||
| - Do NOT include "Generated with Claude Code" in commit messages | ||
| - ALWAYS include "Co-Authored-By: Claude <[email protected]>" at the end of commit messages | ||
|
|
||
| ## Project Overview | ||
|
|
||
| Antenna is an Automated Monitoring of Insects ML Platform. It's a collaborative platform for processing and reviewing images from automated insect monitoring stations, maintaining metadata, and orchestrating multiple machine learning pipelines for analysis. | ||
|
|
@@ -273,7 +283,7 @@ Location: `processing_services/` directory contains example implementations | |
|
|
||
| ### Celery Task Queue | ||
|
|
||
| **Broker & Result Backend:** Redis | ||
| **Broker & Result Backend:** RabbitMQ | ||
|
|
||
| **Key Tasks:** | ||
| - `ami.jobs.tasks.run_job` - Main ML processing workflow | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify RABBITMQ_IP is set in production environment.
The extra_hosts configuration correctly follows the existing pattern for external service resolution. Ensure that the
${RABBITMQ_IP}environment variable is properly defined in your production deployment configuration.🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 473
🏁 Script executed:
Length of output: 821
🏁 Script executed:
Length of output: 887
Add RABBITMQ_IP mapping to docker-compose.worker.yml extra_hosts
The celeryworker service requires RABBITMQ_IP hostname mapping to connect to the external RabbitMQ broker, but this is missing from docker-compose.worker.yml. The celeryworker inherits from the django service which currently only includes DATABASE_IP and REDIS_IP. Add the rabbitmq hostname mapping to lines 16-17 to match the production configuration:
Without this, the Celery worker will fail to resolve the rabbitmq hostname and cannot connect to the broker.
🤖 Prompt for AI Agents