[IPython-dev] do-over: Re: Launchpad?

Glenn Tarbox, PhD glenn@tarbox....
Sat Feb 9 19:22:57 CST 2008


wierd, hit the wrong key in gmail and away we go....

do-over...

the actual "intended" message is below

On 2/9/08, Brian Granger <ellisonbg.net@gmail.com> wrote:
<snip>

> I have a patch I'll put together which integrates twisted with IPython
> > without polling... a slight hack starting with the ASPN code from way
> back.
> > There might be a much better approach given IPython1's direction but the
> > ASPN 1000hz polling loop didn't seem the way to go and I'm not sure I
> get
> > where IPython1 is yet.  I'll clean it up and send it in for opinions.
>
>
> I have done some work on this front this week and finally have a nice
> solution.  There are two pieces:
>
> 1.  I have created a simple class that runs the twisted reactor in the
> thread.


I took the other route... spawned the gtk / IPython thread off and kept the
main thread for twisted.  Of course, its because I was starting with IPython
and the ASPN code (included)


2.  The various parts of the twisted API can be called from ipython
> using a function that recently made it into the twisted trunk, called
> blockingCallFromThread.  This function is not in twisted 2.5.0, so I
> have put it into ipython1 until a new version of twisted is cut.


Interesting, I was under the impression (perhaps mistakenly) that
reactor.callFromThread() was blocking... actually, I think I've passed
return values through it... hmmm... need to go back and check on that.

Brian then writes before I can resend this message

""We are using blockCallFromThread, which is very different from
callFromThread.  But, blockingCallFromThread does block.  It basically
lets you call a twisted using/deferred returning function and block
for the result.  This allows you to run twisted in a thread, but
create blocking interfaces to twisted using things that are in turn
usable from ipython.""

OK, so now I need to read the code.  Might even to do some thinking...

I've included what I did cuz its trivial and only required a couplea lines
to Shell... and a slight mod to the ASPN code (although I don't fully
understand why a bunch of the ASPN stuff was necessary... didn't spend the
time).

So, I'll do so.  I was inverting the approach and intending to only call
into twisted through the proper protections from the gui... I think you're
taking a more general approach which I'll need to noodle on a bit.

- Show quoted text -

This new arrangement is allowing us to develop very robust twisted
> based clients that work in regular python/ipython sessions.  This is a
> massive improvement over anything else we have had before.
>
> Here are the relevant classes in ipython1:
>
>
> http://ipython.scipy.org/ipython/ipython/browser/ipython1/branches/ipython1-client-r3021/ipython1/kernel/twistedutil.py
>
> These things are used here:
>
>
> http://ipython.scipy.org/ipython/ipython/browser/ipython1/branches/ipython1-client-r3021/ipython1/kernel/multiengineclient.py
>
> http://ipython.scipy.org/ipython/ipython/browser/ipython1/branches/ipython1-client-r3021/ipython1/kernel/client.py
>
> I should have this branch ready to merge into ipython1's trunk in a few
> days.
>
> Brian
>
> > --
>
> >
> > -glenn
> >
> > Glenn H. Tarbox, PhD
> > glenn@tarbox.org
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ipython.scipy.org/pipermail/ipython-dev/attachments/20080209/8b84a066/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IPython.diff
Type: text/x-patch
Size: 1721 bytes
Desc: not available
Url : http://lists.ipython.scipy.org/pipermail/ipython-dev/attachments/20080209/8b84a066/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twistedIron.py
Type: text/x-python
Size: 3403 bytes
Desc: not available
Url : http://lists.ipython.scipy.org/pipermail/ipython-dev/attachments/20080209/8b84a066/attachment.py 


More information about the IPython-dev mailing list