From 8c7df5e2f789f04cbc9c436e72eca01772685606 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sat, 23 Sep 2023 23:28:18 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(utils.py):=20change=20get=5F?= =?UTF-8?q?celery=5Fworker=5Fstatus=20function=20to=20use=20app.control.pi?= =?UTF-8?q?ng()=20instead=20of=20i.ping()=20for=20better=20readability=20a?= =?UTF-8?q?nd=20consistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 fix(conftest.py): update LANGFLOW_REDIS_HOST and BROKER_URL environment variables to use "result_backend" instead of "queue" for better clarity and accuracy --- src/backend/langflow/services/task/utils.py | 12 ++++++++++-- tests/conftest.py | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/backend/langflow/services/task/utils.py b/src/backend/langflow/services/task/utils.py index 412b33ae2..e95fbdb33 100644 --- a/src/backend/langflow/services/task/utils.py +++ b/src/backend/langflow/services/task/utils.py @@ -1,6 +1,14 @@ -def get_celery_worker_status(app): +import contextlib +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + with contextlib.suppress(ImportError): + from celery import Celery + + +def get_celery_worker_status(app: "Celery"): i = app.control.inspect() - availability = i.ping() + availability = app.control.ping() stats = i.stats() registered_tasks = i.registered() active_tasks = i.active() diff --git a/tests/conftest.py b/tests/conftest.py index d6e25addf..c58f35cf5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -74,14 +74,14 @@ class Config: @pytest.fixture(name="distributed_env") def setup_env(monkeypatch): monkeypatch.setenv("LANGFLOW_CACHE_TYPE", "redis") - monkeypatch.setenv("LANGFLOW_REDIS_HOST", "queue") + monkeypatch.setenv("LANGFLOW_REDIS_HOST", "result_backend") monkeypatch.setenv("LANGFLOW_REDIS_PORT", "6379") monkeypatch.setenv("LANGFLOW_REDIS_DB", "0") monkeypatch.setenv("LANGFLOW_REDIS_EXPIRE", "3600") monkeypatch.setenv("LANGFLOW_REDIS_PASSWORD", "") monkeypatch.setenv("FLOWER_UNAUTHENTICATED_API", "True") - monkeypatch.setenv("BROKER_URL", "redis://queue:6379/0") - monkeypatch.setenv("RESULT_BACKEND", "redis://queue:6379/0") + monkeypatch.setenv("BROKER_URL", "redis://result_backend:6379/0") + monkeypatch.setenv("RESULT_BACKEND", "redis://result_backend:6379/0") monkeypatch.setenv("C_FORCE_ROOT", "true")