Browse Source

fix celery

tomoya 2 năm trước cách đây
mục cha
commit
aa21e0b095
2 tập tin đã thay đổi với 3 bổ sung8 xóa
  1. 1 2
      backend/app/app/core/celery_app.py
  2. 2 6
      backend/app/app/worker.py

+ 1 - 2
backend/app/app/core/celery_app.py

@@ -4,5 +4,4 @@ celery_app = Celery("worker", broker="redis://172.104.93.163:16379/0")
 
 
 
-celery_app.conf.task_routes = {"app.worker.test_celery": "main-queue", 
-                               "app.worker.make_video": "main-queue"}
+celery_app.conf.task_routes = {"app.worker.make_video": "main-queue"}

+ 2 - 6
backend/app/app/worker.py

@@ -15,14 +15,10 @@ ZIP_STORAGE = Path(settings.CELERY_ZIP_STORAGE)
 VIDEO_STORAGE = Path(settings.CELERY_VIDEO_STORAGE)
 
 
-@celery_app.task(acks_late=True)
-def test_celery(word: str) -> str:
-    return f"test task return {word}"
-
 
 @celery_app.task(acks_late=True)
-def make_video(args:list) -> str:
-    video_id, zip_filename, user_id = args
+def make_video(video_id, zip_filename, user_id) -> str:
+    #video_id, zip_filename, user_id = args
     # download 
     r = requests.get(download_to_local_url, stream=True)
     with open(str(VIDEO_STORAGE/zip_filename), 'wb') as f: