Celery 使用 Ansible API 结果 返回 None 无返回
方法1
# 在celery 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"}
# ...do something...
return "hello world"
create_task.apply_async(
...
)
方法2
export PYTHONOPTIMIZE=1
再启动 supervisor celery
print(__debug__) # false is ok

浙公网安备 33010602011771号