[IPython-User] Debug code on ipengine in IDE (Re: Question about schedulers)
Jon Olav Vik
jonovik@gmail....
Fri Jun 8 16:54:16 CDT 2012
Darren Govoni <darren <at> ontrenet.com> writes:
> Incidentally, I discovered that I can execute the ipengine code directly
> in my python IDE and set break points in my user code modules and when I
> execute functions from remote clients/views, it will hit the break
> points and let me debug my code visually (in the running engine). Pretty
> sweet. Though I'd share.
Brilliant! This works in Eclipse PyDev on Windows too. What I did:
1. Create an Eclipse project for the c:\python27\scripts folder.
2. Run "ipcluster start --n=0", e.g. in a command window.
3. In Eclipse, open the code you want to debug and set a breakpoint there.
4. In your "scripts" Eclipse project, open ipengine-script.py and "debug as
python run".
5. Run some code that uses IPython.parallel.Client().
In the example below,
cell.py is my main script.
It creates a Client()
which parallelizes cell.py:do(),
which calls task.py:pace().
The "debug" tab in Eclipse shows an impressive call stack:
scripts ipengine-script.py [Python Run]
ipengine-script.py
MainThread - pid6940_seq2
pace [task.py:26]
do [cell.py:54]
<module> [<string>:1]
apply_request [streamkernel.py:337]
dispatch_queue [streamkernel.py:399]
dispatcher [streamkernel.py:408]
_run_callback [zmqstream.py:365]
_handle_recv [zmqstream.py:424]
_handle_events [zmqstream.py:391]
start [ioloop.py:330]
start [ipengineapp.py:316]
launch_new_instance [ipengineapp.py:325]
<module> [ipengine-script.py:9]
run [pydevd.py:1060]
<module> [pydevd.py:1346]
Thread-4 - pid6940_seq4
ipengine-script.py
metamod cell.py (1) [Python Run]
C:\git\metamod\cell.py
More information about the IPython-User
mailing list