Celery + Ansible 执行任务无返回值

Celery + Ansible 执行任务无返回值

在@app.task修饰的方法中加入

from multiprocessing import current_process
current_process()._config={"semprefix":"/mp"}

栗子

@app.task
def create_task()
    from multiprocessing import current_process
    current_process()._config={"semprefix":"/mp"}
    return "hello world"

create_task.delay()

参考地址

原文地址:https://www.cnblogs.com/jruing/p/14506896.html