From ad51ad7d3aeec7b2214008bb8e155add27d291df Mon Sep 17 00:00:00 2001 From: Matt Daily Date: Thu, 5 Sep 2024 14:59:47 -0700 Subject: [PATCH 1/3] Update celery beat entrypoint for celery 5 The docs are here https://docs.celeryq.dev/en/stable/reference/celery.apps.beat.html This was breaking in production as we were using an outdated call to the celery beat binary. Help from this stack overflow comment: https://stackoverflow.com/a/65213590 --- banzai/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/banzai/main.py b/banzai/main.py index e0fc4e66..34d1a827 100755 --- a/banzai/main.py +++ b/banzai/main.py @@ -174,10 +174,8 @@ def start_stacking_scheduler(): schedule_calibration_stacking.s(site=site, runtime_context=vars(runtime_context)), queue=runtime_context.CELERY_TASK_QUEUE_NAME) - beat = celery.bin.beat.beat(app=app) + app.Beat(schedule='/tmp/celerybeat-schedule', pidfile='/tmp/celerybeat.pid', working_directory='/tmp').run() logger.info('Starting celery beat') - beat.run(schedule='/tmp/celerybeat-schedule', pidfile='/tmp/celerybeat.pid', working_directory='/tmp') - def run_realtime_pipeline(): extra_console_arguments = [{'args': ['--n-processes'], From f74487dfb6efa4deefe34cdd6eebbde08ab31c6d Mon Sep 17 00:00:00 2001 From: Matt Daily Date: Thu, 5 Sep 2024 15:03:08 -0700 Subject: [PATCH 2/3] Update changelog --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index e2d7709f..979ba732 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +1.18.2 (2024-08-28) +------------------- +- Fix call to start celery beat for celery 5 + 1.18.1 (2024-08-28) ------------------- - Update celery config to turn off gossip and mingle as workers were missing lots of heartbeats and were throwing errors. See https://www.cloudamqp.com/docs/celery.html#commandline-arguments for details From 198595858fc2afc89077d657a83b832e885b694d Mon Sep 17 00:00:00 2001 From: Matt Daily Date: Fri, 6 Sep 2024 14:34:55 -0700 Subject: [PATCH 3/3] Constrain celery's upper bound version to <6 No more breaking changes, please. --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 28c222b0..d21c76a9 100755 --- a/setup.cfg +++ b/setup.cfg @@ -61,7 +61,7 @@ install_requires = pytest>=4.0 pyyaml psycopg2-binary - celery[redis]>5 + celery[redis]>5,<6 apscheduler python-dateutil ocs_ingester>=3.0.4,<4.0.0