Let's say that I have set a breakpoint in the code bellow:
from celery import Celery
app = Celery('hello', broker...)
@app.task
def hello():
breakpoint()
return 'hello world'
If I execute in pdb: app.current_task.request I get:
<Context: {'lang': 'py', 'task': ..., 'id': '7ca0cbee-1a71-437c-b4be-c623429a2b21',... , 'root_id': '38ab28f2-9f79-45da-b2e5-f00bd0beb104', 'parent_id': '38ab28f2-9f79-45da-b2e5-f00bd0beb104', ...}>
Now I would like to get parent task (app.current_task.request.parent_id) in order to inspect its request/result.
Something like:
parent = ....get('38ab28f2-9f79-45da-b2e5-f00bd0beb104')
print(parent.request)
print(parent.result)
How to do that inside of the task where the breakpoint is set?