remove celery and use dramatiq

This commit is contained in:
virusdefender committed 2019-03-11 17:59:24 +08:00
1 parent 1af50c0f4c
commit a5f0c8eb31
16 files changed
+65 -61

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ def process_pending_task():
# 防止循环引入
from judge.tasks import judge_task
data = json.loads(cache.rpop(CacheKey.waiting_queue).decode("utf-8"))
judge_task.delay(**data)
judge_task.send(**data)
class DispatcherBase(object):
+3 -3
View File
@@ -1,12 +1,12 @@
from __future__ import absolute_import, unicode_literals
from celery import shared_task
import dramatiq
from account.models import User
from submission.models import Submission
from judge.dispatcher import JudgeDispatcher
from utils.shortcuts import DRAMATIQ_WORKER_ARGS
@shared_task
@dramatiq.actor(**DRAMATIQ_WORKER_ARGS())
def judge_task(submission_id, problem_id):
uid = Submission.objects.get(id=submission_id).user_id
if User.objects.get(id=uid).is_disabled: