如何修复 "Celery is receiving tasks but while executing it stuck"

How to fix "Celery is receiving tasks but while executing it stuck"

我正在处理 AI 图像处理工作,我使用 Django rest 框架、Python3、tensorflow 和 keras 以及 Celery 来处理异步任务。我也在使用redis服务器。但是当我执行 celery 任务时,它正在接收任务但卡在中间。它一直在发生。我正在尝试为 amazon ec2 g3s.xlarge 实例提供它,尽管它 运行 在我的本地机器上很好。

我正在尝试将其部署到具有深度学习 AMI (linux) 版本的 amazon ec2 g3s.xlarge 实例中。

@task(name="predict")
def work_out(cow_front_image,cow_back_image):
    return detect_cow_weight(cow_front_image,cow_back_image)

这是一个大项目,不知道如何在这里显示所有代码。

I repeat its running fine and quite comfortably in the local machine and also I used the all the configuration from one of our existing server served product which is production grade.

我希望 celery 任务能够执行,就像我将传递两个图像作为参数然后它将处理图像并返回他在后台看到的结果。

我得到了修复--pool=solo

 celery -A prodapi worker -l info --without-gossip --without-mingle --without-heartbeat -Ofair --pool=solo