diff --git a/celery_app/server.py b/celery_app/server.py index 499aff0..46be7e5 100644 --- a/celery_app/server.py +++ b/celery_app/server.py @@ -1,4 +1,8 @@ +import os + from celery import Celery +from dotenv import load_dotenv +from traceloop.sdk import Traceloop from utils.credentials import load_rabbitmq_credentials rabbit_creds = load_rabbitmq_credentials() @@ -7,5 +11,9 @@ host = rabbit_creds["host"] port = rabbit_creds["port"] +load_dotenv() +otel_endpoint = os.getenv("TRACELOOP_BASE_URL") +Traceloop.init(api_endpoint=otel_endpoint, app_name="hivemind-server") + app = Celery("celery_app/tasks", broker=f"pyamqp://{user}:{password}@{host}:{port}//") app.autodiscover_tasks(["celery_app"]) diff --git a/celery_app/tasks.py b/celery_app/tasks.py index b32e1c3..991a8f9 100644 --- a/celery_app/tasks.py +++ b/celery_app/tasks.py @@ -1,11 +1,9 @@ import json import logging -import os from typing import Any from celery_app.server import app from celery_app.utils.fire_event import job_send -from dotenv import load_dotenv from subquery import query_multiple_source from tc_messageBroker.rabbit_mq.event import Event from tc_messageBroker.rabbit_mq.payload.discord_bot.base_types.interaction_callback_data import ( @@ -16,7 +14,6 @@ ) from tc_messageBroker.rabbit_mq.payload.payload import Payload from tc_messageBroker.rabbit_mq.queue import Queue -from traceloop.sdk import Traceloop @app.task @@ -43,10 +40,6 @@ def ask_question_auto_search( - `date` - `content`: which is the `ChatInputCommandInteraction` as a dictionary """ - load_dotenv() - otel_endpoint = os.getenv("TRACELOOP_BASE_URL") - Traceloop.init(api_endpoint=otel_endpoint, app_name="Hivemind-server") - prefix = f"COMMUNITY_ID: {community_id} | " logging.info(f"{prefix}Processing question!")