在烧瓶中使用芹菜得到exitcode 2错误



关于烧瓶和芹菜的问题-

init.py
from celery import Celery
from flask import Flask
app.config['CELERY_RESULT_BACKEND'] = 'redis://localhost'
app.config['CELERY_BROKER_URL'] = 'redis://localhost'
celery = Celery(app.name, broker=app.config['CELERY_BROKER_URL'])
celery.conf.update(app.config)
training.py
from project import celery
training = Blueprint('training', __name__)
@training.route('/projectdetails/training', methods=["GET", "POST"])
@login_required
def start_training():
train_test.delay()
return render_template('test.html')
@celery.task()
def train_test():
# a ML training task. 

我有我的redis服务器和我的芹菜工人celery -A myproject.celery worker --loglevel=info

这是一个错误,我一直得到-

[2021-04-01 17:25:11,604: ERROR/MainProcess] Process 'ForkPoolWorker-8' pid:67580 exited with 'exitcode 2'
[2021-04-01 17:25:11,619: ERROR/MainProcess] Task handler raised error: WorkerLostError('Worker exited prematurely: exitcode 2.')
Traceback (most recent call last):
File "/Users/rohankamath/Desktop/lol/env/lib/python3.7/site-packages/billiard/pool.py", line 1267, in mark_as_worker_lost
human_status(exitcode)),
billiard.exceptions.WorkerLostError: Worker exited prematurely: exitcode 2.

尝试在exitcode2上搜索含义,但找不到任何内容。

当我的代码中出现一些导入错误时,我就遇到了这种情况。你能试着在没有芹菜的情况下运行(直接调用主函数(,看看它是否有效吗?

最新更新