celery 调用 ansbile api 报错


  File "/usr/local/lib/python3.6/multiprocessing/synchronize.py", line 117, in _make_name
    return '%s-%s' % (process.current_process()._config['semprefix'],
AttributeError: 'Worker' object has no attribute '_config'

处理方法:

在任务里面加一句

 from multiprocessing import current_process
 
 
@app.task
def  ansbile():


        current_process()._config = {'semprefix': '/mp'}
		
		print(123)