First time here? Check out the FAQ!
0

Debugging Externally Launched Code (Celery)

Hi,

I'm trying remote debugging for the first time and can't get it to trigger.  I am trying to debug a problem I'm having getting Celery to run.  I've put the import wingdbstub, etc. code in my worker code and set a break point on the print statement.

celery_app.conf.imports = [ 'app_web.tasks.tasks']
import wingdbstub
x = 0 / 0
# 
import pdb; pdb.set_trace()
print(True)

When I ran Celery ( celery worker -A celery_worker.celery_app --loglevel=info ), the debugger didn't fire.  I added the pdb statements and I got a RuntimeError:WARNING: sys.settrace(<bound method="" bdb.trace_dispatch="" of="" <pdb.pdb="" object="" at="" 0x04c71d90="">>) called: This breaks some debugger functionality. Use 'Ignore this exception location' in the Exceptions tool and restart debugging to suppress this warning but since I didn't get an exception in the IDE I don't see how to ignore it.  

I then added the divide by 0 which throws an exception hoping to trigger the debugger but nope. File "D:\SVNRepo\projects-sw\ESI\trunk\env\src\celery_worker.py", line 46, in <module> x = 0 / 0ZeroDivisionError: division by zeroOn Windows celery.exe is starting the process but pdb has been triggering in celery_worker, can I get Wing to trigger?

Win 7/64, Python 3.6.2 (Anaconda), Wing 6.0.7-1 (rev 47fe5b0dd72b), accept debug connections is checked, wingdbstub.py and wingdebugpw are in the same directory as celery_worker.py

Thanks,

Eric

Eric Earnst's avatar
36
Eric Earnst
asked 2017-09-11 01:58:00 -0500
Wingware Support's avatar
4k
Wingware Support
updated 2019-03-13 10:14:48 -0500
edit flag offensive 0 remove flag close merge delete

Comments

You don't want to use pdb and Wing's debugger at the same time.  Wing's debugger is a replacement for pdb (with many more features, of course).  Did you tell Wing to listen for debug connections?  To do that, right click on the bug icon in lower left and check on Accept Debug Connections.  If that does not work, try setting kLogFile in wingdbstub.py to see if that indicates why debugging is not starting.  You can send that to support@wingware.com to get help intepreting it.

Wingware Support's avatar Wingware Support (2017-09-11 09:51:00 -0500) edit

Accept debug connections is checked and I'd already configured kLogFile to write to the same directory as the other files; at least the first time I tried it I didn't see a log file.  I was doing this at home last night and I can't remotely log in now for some reason.  The only thing you need to do in Wing is to set a breakpoint?  pdb did launch when I was running it alone.

Eric Earnst's avatar Eric Earnst (2017-09-11 11:50:00 -0500) edit

A log file should be created if the process that is being debugged has permission to write to the file. Could you set kExitOnFailure to True?  The import wingdbstub should raise an exception with kExitOnFailure set to true; please send the traceback to support@wingware.comEither pdb or the wing debugger can be used, but they don't work together because only one debugger can be enabled at a time. 

Wingware Support's avatar Wingware Support (2017-09-11 12:04:00 -0500) edit
add a comment see more comments

1 Answer

1

I switched over to adding wingdbstub to celery.py and, after resolving an issue with the port number that Wing was watching it all worked!

Eric Earnst's avatar
36
Eric Earnst
answered 2017-09-14 16:56:00 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer