build(env): extract Redis URL into env file
This could allow one to connect to a remote Redis instance with a powerful GPU, allowing one to offload the NLP work.
This commit is contained in:
@@ -18,5 +18,10 @@ HF_HOME=/models/huggingface
|
||||
TRANSFORMERS_CACHE=/models/huggingface
|
||||
TORCH_HOME=/models/torch
|
||||
|
||||
# Frontend
|
||||
# URLs
|
||||
FRONTEND_URL=http://localhost:5173
|
||||
BACKEND_URL=http://backend:5000
|
||||
REDIS_URL=redis://redis:6379/0
|
||||
|
||||
# API & Scraping
|
||||
MAX_FETCH_LIMIT=1000
|
||||
@@ -1,10 +1,15 @@
|
||||
from celery import Celery
|
||||
from dotenv import load_dotenv
|
||||
from server.utils import get_env
|
||||
|
||||
load_dotenv()
|
||||
REDIS_URL = get_env("REDIS_URL")
|
||||
|
||||
def create_celery():
|
||||
celery = Celery(
|
||||
"ethnograph",
|
||||
broker="redis://redis:6379/0",
|
||||
backend="redis://redis:6379/0",
|
||||
broker=REDIS_URL,
|
||||
backend=REDIS_URL,
|
||||
)
|
||||
celery.conf.task_serializer = "json"
|
||||
celery.conf.result_serializer = "json"
|
||||
|
||||
Reference in New Issue
Block a user