Spaces:
Runtime error
Runtime error
File size: 1,872 Bytes
3cecacc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
from celery import Celery
from dotenv import load_dotenv
import os
import torch
import random
import numpy as np
import torch
import os
import hashlib
import sys
import uuid
from db_models.music import *
from db_models.billing import *
from db_models.notification import *
from db_models.user import *
from db_models.data import *
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'quick-hangout-422604-e3-5f7544b49207.json'
# νκ²½ λ³μ λ‘λ
load_dotenv()
REDIS_PASSWORD = os.getenv('TEST_REDIS_PASSWORD')
REDIS_PORT = os.getenv('TEST_REDIS_PORT')
REDIS_HOST = os.getenv('TEST_REDIS_HOST')
# # νκ²½ λ³μμμ Redis μ°κ²° μ 보 κ°μ Έμ€κΈ°
# REDIS_PASSWORD = os.getenv('REDIS_PASSWORD')
# REDIS_PORT = os.getenv('REDIS_PORT')
# REDIS_HOST = os.getenv("REDIS_HOST")
common_conf = {
'broker_connection_retry_on_startup': True, # μμ μ μ°κ²° μ¬μλ νμ±ν
'broker_transport_options': {
'max_retries': 5, # μ΅λ μ¬μλ νμ
'interval_start': 0.1, # 첫 μ¬μλ κ°κ²© (μ΄)
'interval_step': 0.2, # μ¬μλ κ°κ²© μ¦κ° (μ΄)
'interval_max': 0.5, # μ΅λ μ¬μλ κ°κ²© (μ΄)
},
'broker_connection_timeout': None, # μ°κ²° μκ° μ΄κ³Ό (μ΄), NoneμΌλ‘ μ€μ νμ¬ λ¬΄μ ν
'worker_concurrency': 1, # λμμ±μ 1λ‘ μ€μ
}
# μ λ²μ μμ μ²λ¦¬μ© Celery μ ν리μΌμ΄μ
AI_detection_celery_app = Celery(
'mippia',
broker=f'redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}/0',
backend=f'redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}/1',
)
AI_detection_celery_app.conf.update(common_conf)
AI_detection_celery_app.conf.task_routes = {"worker.AI_detection_task": "AI-detection-queue"}
AI_detection_celery_app.conf.task_default_queue = "AI-detection-queue"
from worker import AI_detection_task # workerμμ νμ€ν¬λ₯Ό λ±λ‘ν©λλ€. |