📦 chore(core): add Celery configuration files

 feat(celery_app.py): add Celery app configuration for langflow with Redis as broker and backend
 feat(celeryconfig.py): add Celery configuration file with environment variable support for broker URL and result backend URL
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-13 19:25:28 -03:00
commit 43ba81c2ee
3 changed files with 14 additions and 0 deletions

View file

View file

@ -0,0 +1,7 @@
from celery import Celery
celery_app = Celery(
"langflow", broker="redis://queue:6379/0", backend="redis://queue:6379/0"
)
# command: celery -A langflow.worker.celery_app worker --loglevel=INFO
celery_app.conf.task_routes = {"langflow.worker.tasks.*": {"queue": "langflow"}}

View file

@ -0,0 +1,7 @@
# celeryconfig.py
import os
broker_url = os.environ.get("BROKER_URL", "redis://localhost:6379/0")
result_backend = os.environ.get("RESULT_BACKEND", "redis://localhost:6379/0")
# tasks should be json or pickle
accept_content = ["json", "pickle"]