[IPython-User] Debug code on ipengine in IDE
Darren Govoni
darren@ontrenet....
Fri Jun 8 17:07:21 CDT 2012
Nice! And I'm sure the debugger will do its own context switching if or
when any user threads come into play as well - complete with call
stacks. In fact, I can jump back in the call stack in my debugger and
inspect a prior context, then resume normal execution. Definitely cool
within the scope of ipython parallel tasks execution. Very easy to debug
client side AND engine side at once.
On Fri, 2012-06-08 at 21:54 +0000, Jon Olav Vik wrote:
> 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
>
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
More information about the IPython-User
mailing list