149fb49b by 周伟奇

celery init

1 parent 5af23667
......@@ -5,6 +5,7 @@ appdirs==1.4.4
async-timeout==3.0.1
attrs==19.3.0
cached-property==1.5.1
celery==4.4.2
certifi==2020.6.20
chardet==3.0.4
defusedxml==0.6.0
......
......@@ -19,6 +19,7 @@ from .models import UploadDocRecords, DocStatus, PriorityApplication, GCAPRecord
from .mixins import DocHandler
from . import consts
from apps.account.authentication import OAuth2AuthenticationWithUser
from celery_compare.tasks import test
# restframework将request.body封装至request.data, webargs从request.data中获取参数
......@@ -312,6 +313,7 @@ class CompareView(GenericView):
@use_args(compare_args, location='data')
def post(self, request, args):
self.running_log.info('in')
test.apply_async((args, ), queue='queue_compare')
return response.ok()
post.openapi_doc = '''
......
from celery import Celery
from settings import conf
broker = conf.CELERY_BROKER_URL
app = Celery('celery_compare', broker=broker, include=['celery_compare.tasks'])
app.conf.update(worker_max_tasks_per_child=5, timezone='Asia/Shanghai')
\ No newline at end of file
from . import app
@app.task
def test(info):
print(info)
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!