Feat: Add celery beat for scheduling new cronjobs - #2813
Draft
susilnem wants to merge 4 commits into
Draft
Conversation
thenav56
approved these changes
Aug 17, 2026
- Introduce django-celery-beat
- main/cronjobs.py: SCHEDULES registry, kombu queues (default/heavy/cronjob)
feeding task_queues, per-job Sentry monitor config, and a beat_init hook
that prunes PeriodicTask rows for removed jobs ("manual:" rows spared)
- seed jobs: clear_expired_django_sessions (django_session was never pruned)
and a per-queue celery_queue_uptime_check heartbeat
- main/sentry.py: SentryConfig dataclass, every option passed to
sentry_sdk.init() by name so an unrecognised key cannot reach it
- SENTRY_DEBUG decouples Sentry verbosity from DJANGO_DEBUG
- misc/dev: worker and beat entrypoints with a broker wait
- tests in main/test_cronjobs.py, a django check for SCHEDULES task paths,
and docs/cronjobs.md
The banjo stack passes traces_sampler= to SENTRY_CONFIG, but the SentryConfig dataclass only had traces_sample_rate, so settings import raised TypeError: unexpected keyword argument 'traces_sampler' in every process where SENTRY_DSN is set. Keep the rate on the dataclass and build banjo's health-probe-ignoring sampler inside init_sentry(), so the config stays plain data and dataclasses.replace() does not carry a closure.
Adds app.worker.addons.beat so the cronjobs in main/cronjobs.py actually run in deployed environments; previously beat existed only in docker-compose. - replicaCount: 1 with strategy: Recreate -- two beat processes would fire every cronjob twice - --scheduler=banjo_utils.celery_health.database.HeartbeatDatabaseScheduler so banjo-celery-probe can check liveness - SENTRY_DEBUG and SENTRY_MONITOR_CELERY_BEAT_TASKS added to app.env - snapshots regenerated for alpha/staging/production
susilnem
force-pushed
the
feature/setup-celery-beat
branch
from
September 9, 2026 06:41
ea93c8e to
b443e33
Compare
susilnem
force-pushed
the
feature/setup-celery-beat
branch
from
September 9, 2026 09:08
b443e33 to
9948ab4
Compare
Replaces misc/wait-for-broker.sh with banjo's `manage.py wait_for_resources --db --celery-broker`, which also waits for the database instead of only the broker.
susilnem
force-pushed
the
feature/setup-celery-beat
branch
from
September 9, 2026 09:51
9948ab4 to
522af1f
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Introduce django-celery-beat so new cronjobs can be declared in code and
dispatched by a beat process, instead of adding another Kubernetes CronJob.
Existing cronjobs are untouched. The 30 legacy jobs keep running as k8s
CronJobs from values.yaml:cronjobs and stay monitored via SentryMonitor +
manage.py cron_job_monitor. A job belongs to one mechanism or the other,never both -- SentryMonitor.validate_config() asserts the enum matches
values.yaml.
Changes
Checklist
Things that should succeed before merging.
Release
If there is a version update, make sure to tag the repository with the latest version.