🐛 fix(utils.py): change get_celery_worker_status function to use app.control.ping() instead of i.ping() for better readability and consistency

🐛 fix(conftest.py): update LANGFLOW_REDIS_HOST and BROKER_URL environment variables to use "result_backend" instead of "queue" for better clarity and accuracy
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-09-23 23:28:18 -03:00
commit 8c7df5e2f7
2 changed files with 13 additions and 5 deletions

View file

@ -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()

View file

@ -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")