Ask Your Question
0

Debugging Externally Launched Code (Celery)

asked 2017-09-11 01:58:00 -0500

Eric Earnst gravatar image

updated 2019-03-13 10:14:48 -0500

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

edit retag flag offensive 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 gravatar imageWingware 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 gravatar imageEric 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 gravatar imageWingware Support ( 2017-09-11 12:04:00 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2017-09-14 16:56:00 -0500

Eric Earnst gravatar image

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!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-09-11 01:58:00 -0500

Seen: 6,237 times

Last updated: Mar 07