It works using AsyncResult
. (see this answer)
So first create the task:
from cel.tasks import add
res = add.delay(3,4)
print(res.status) # 'SUCCESS'
print(res.id) # '432890aa-4f02-437d-aaca-1999b70efe8d'
Then start another python shell:
from celery.result import AsyncResult
from cel.tasks import app
res = AsyncResult('432890aa-4f02-437d-aaca-1999b70efe8d',app=app)
print(res.state) # 'SUCCESS'
print(res.get()) # 7
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…