Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local variables not present at Python's rdb debugging breakpoint (in celery task)

I am trying to debug a celery task but the parameters and local variables aren't present when I telnet in:

from celery import Celery
from celery.contrib import rdb

celery = Celery('tasks', broker="redis://localhost:6379/0")

@celery.task
def add(x, y):
  someVar = 3
  rdb.set_trace()

In a different terminal:

telnet 127.0.0.1 6902 (or whatever the port number is)

x, y and someVar will all produce a name error like: NameError: name 'x' is not defined

like image 622
AJP Avatar asked Jan 31 '26 04:01

AJP


1 Answers

To check if you are in the current stack frame, use the u and d (up and down) to move up and down (http://docs.python.org/2/library/pdb.html#debugger-commands)

You can see which file you're in (it's written in the pdb prompt). Usually you have to go up once or twice to get to the right file, from what I've experienced

like image 51
Noé Malzieu Avatar answered Feb 02 '26 18:02

Noé Malzieu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!