diff --git a/.run/Celery Beat.run.xml b/.run/Celery Beat.run.xml new file mode 100644 index 00000000000..56899ad0bba --- /dev/null +++ b/.run/Celery Beat.run.xml @@ -0,0 +1,31 @@ + + + + + \ No newline at end of file diff --git a/.run/Dev.run.xml b/.run/Dev.run.xml index 52b305471f1..48c1f35c7da 100644 --- a/.run/Dev.run.xml +++ b/.run/Dev.run.xml @@ -3,6 +3,7 @@ + diff --git a/posthog/management/commands/run_autoreload_celery.py b/posthog/management/commands/run_autoreload_celery.py index cefb49df0ed..a9dd349eac4 100644 --- a/posthog/management/commands/run_autoreload_celery.py +++ b/posthog/management/commands/run_autoreload_celery.py @@ -1,4 +1,5 @@ from typing import Literal + import django from django.core.management.base import BaseCommand @@ -23,22 +24,20 @@ class Command(BaseCommand): def run_celery_worker(type: Literal["worker", "beat"]): from posthog.celery import app as celery_app - args = ( - [ - "-A", - "posthog", - "worker", - "--pool=threads", - f"--queues={','.join(q.value for q in CeleryQueue)}", - ] - if type == "worker" - else [ - "-A", - "posthog", + if type == "beat": + args = [ "beat", "--scheduler", "redbeat.RedBeatScheduler", ] - ) + celery_app.start(argv=args) + return + args = [ + "-A", + "posthog", + "worker", + "--pool=threads", + f"--queues={','.join(q.value for q in CeleryQueue)}", + ] celery_app.worker_main(args)