Skip to content

feat(async): Add django-q2 with ORM broker and demo job#161

Open
taylor-osler-sentry wants to merge 4 commits intomainfrom
feat/async
Open

feat(async): Add django-q2 with ORM broker and demo job#161
taylor-osler-sentry wants to merge 4 commits intomainfrom
feat/async

Conversation

@taylor-osler-sentry
Copy link
Copy Markdown
Contributor

@taylor-osler-sentry taylor-osler-sentry commented Apr 30, 2026

Summary

  • Adds django-q2 as a dependency and configures it with the ORM broker (backed by the existing PostgreSQL default database)
  • Introduces firetower.incidents.tasks.schedule_demo as the first queue task (stub that prints "hello world"), registered via a data migration
  • Extends docker/entrypoint.sh with a worker command that starts qcluster, and refactors all branches to use exec for proper signal handling in Docker

Test plan

  • Run python manage.py migrate — confirm 0015_schedule_demo applies cleanly and a schedule_slo_nag row appears in django_q_schedule
  • Run python manage.py qcluster — confirm the worker starts and picks up the scheduled task
  • Run docker/entrypoint.sh worker — confirm the container starts the qcluster process
  • Unapply migration (migrate incidents 0014) — confirm the schedule row is removed

🤖 Generated with Claude Code

@taylor-osler-sentry taylor-osler-sentry requested a review from a team as a code owner April 30, 2026 21:53
@taylor-osler-sentry taylor-osler-sentry marked this pull request as draft April 30, 2026 21:53
Comment thread src/firetower/settings.py Outdated
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Apr 30, 2026

Comment thread src/firetower/incidents/apps.py Outdated
Comment thread src/firetower/incidents/tasks.py
Comment thread src/firetower/incidents/tasks.py Outdated
Comment thread src/firetower/settings.py
Comment thread src/firetower/settings.py Outdated
@taylor-osler-sentry taylor-osler-sentry changed the title feat(async): Add django-q2 with ORM broker and schedule_slo_nag job feat(async): Add django-q2 with ORM broker and demo job May 5, 2026
@taylor-osler-sentry taylor-osler-sentry marked this pull request as ready for review May 5, 2026 21:43
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit eca2c31. Configure here.

@@ -0,0 +1,28 @@
from django.db import migrations

from firetower.incidents.tasks import SCHEDULES
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration imports mutable runtime code from tasks module

Medium Severity

The migration imports SCHEDULES from firetower.incidents.tasks at module level, coupling it to mutable runtime code. If SCHEDULES is ever renamed, restructured, or the "schedule_demo" key is removed, this migration will break on any fresh database. Additionally, importing tasks.py triggers from firetower.incidents.models import Incident, pulling in the live model class rather than the historical version — and any future import-time side effects in tasks.py will also fire during migration. The schedule data (func, schedule_type, minutes, repeats) can be inlined directly in the migration to keep it self-contained.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit eca2c31. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant