mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-21 13:39:22 +01:00
fix: Start non-worker celery command with app.start() (#24375)
Co-authored-by: Julian Bez <julian@posthog.com>
This commit is contained in:
parent
6964802f82
commit
22e689c8f3
31
.run/Celery Beat.run.xml
Normal file
31
.run/Celery Beat.run.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Celery Beat" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="posthog" />
|
||||
<option name="ENV_FILES" value="$PROJECT_DIR$/bin/celery-queues.env" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
<env name="CLICKHOUSE_SECURE" value="False" />
|
||||
<env name="DATABASE_URL" value="postgres://posthog:posthog@localhost:5432/posthog" />
|
||||
<env name="DEBUG" value="1" />
|
||||
<env name="KAFKA_HOSTS" value="localhost" />
|
||||
<env name="SKIP_SERVICE_VERSION_REQUIREMENTS" value="1" />
|
||||
<env name="REPLAY_EMBEDDINGS_ALLOWED_TEAM" value="1,2,3" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="$PROJECT_DIR$/env/bin/python" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/manage.py" />
|
||||
<option name="PARAMETERS" value="run_autoreload_celery --type=beat" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
@ -3,6 +3,7 @@
|
||||
<toRun name="PostHog" type="Python.DjangoServer" />
|
||||
<toRun name="Frontend" type="js.build_tools.npm" />
|
||||
<toRun name="Plugin Server" type="js.build_tools.npm" />
|
||||
<toRun name="Celery Beat" type="PythonConfigurationType" />
|
||||
<toRun name="Celery Threads" type="PythonConfigurationType" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user