importing client.TaskClient() hangs

Bug #497419 reported by Robert Ferrell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
IPython
Fix Committed
Undecided
Unassigned

Bug Description

If I start an interactive session and type:

import IPython
from IPython.kernel import client
tc = client.TaskClient()

at the prompt, I get going fine. If I put those commands in a file
and run them as a script, that's fine. But, if I put them in a file
and import the file into an interactive IPython session, it hangs when
I try to get a TaskClient.

This is on OS X 10.6, Python 2.6.1, ipython 0.10.

Revision history for this message
Robert Ferrell (ferrell) wrote :

This looks a bit like bug #300218, but isn't the same (to my eyes).

I traced the problem as far as:

        try: # restore state no matter what (e.g., KeyboardInterrupt)
            if timeout is None:
                waiter.acquire()
                if __debug__:
                    self._note("%s.wait(): got it", self)

in wait() in lib/python2.6/threading.py. The call to waiter.acquire() never returns. (That's line 237 in my version of threading.py)

Revision history for this message
Vishal Vatsa (vvatsa) wrote : Re: [Bug 497419] [NEW] importing client.TaskClient() hangs

Hi

How where you importing the file into the interactive session?
Was it %run

Also would you mind replicating this on a current bazaar checkout of trunk.
You can get the branch once you have bzr installed as follows:

bzr branch lp:ipython

I don't have 0.10 set up at the moment, but I can verify that on 0.9.1
and on the trunk
check out it is not a problem. I will test on 0.10 later.

Thanks for the bug report.
Regards,
-vishal

2009/12/16 Robert Ferrell <email address hidden>:
> Public bug reported:
>
> If I start an interactive session and type:
>
> import IPython
> from IPython.kernel import client
> tc = client.TaskClient()
>
> at the prompt, I get going fine.  If I put those commands in a file
> and run them as a script, that's fine.  But, if I put them in a file
> and import the file into an interactive IPython session, it hangs when
> I try to get a TaskClient.
>
> This is on OS X 10.6,  Python 2.6.1, ipython 0.10.
>
> ** Affects: ipython
>     Importance: Undecided
>         Status: New
>
> --
> importing client.TaskClient() hangs
> https://bugs.launchpad.net/bugs/497419
> You received this bug notification because you are a member of IPython
> Developers, which is subscribed to IPython.
>
> Status in IPython - Enhanced Interactive Python: New
>
> Bug description:
> If I start an interactive session and type:
>
> import IPython
> from IPython.kernel import client
> tc = client.TaskClient()
>
> at the prompt, I get going fine.  If I put those commands in a file
> and run them as a script, that's fine.  But, if I put them in a file
> and import the file into an interactive IPython session, it hangs when
> I try to get a TaskClient.
>
> This is on OS X 10.6,  Python 2.6.1, ipython 0.10.
>
>
>

Revision history for this message
Robert Ferrell (ferrell) wrote :

I get the error when I 'import file1'. If I '%run file1' there is no problem.

A bit more specific:

file1.py
==========================================
import IPython
from IPython.kernel import client
print 'Imported client'
tc = client.TaskClient()
print 'Got client'
==========================================

file2.py
==========================================
print 'In file 2'
import file1
print 'Imported file1'
==========================================

At the shell (not inside ipython),
$python file1.py
works fine
$python file2.py
hangs.

The situation is similar inside an ipython shell. %run file1 works fine. import file1 hangs. %run file2 hangs.

I'll see if I can replicate this with the current bazaar checkout. I'm on Snow Leopard, so things feel a little fragile for me. (I backed down from 0.11 because of some other problem.)

Revision history for this message
Vishal Vatsa (vvatsa) wrote : Re: [Bug 497419] Re: importing client.TaskClient() hangs

Yep, I can replicate it with import as you have described on 0.11 and 0.9.1
Worth further investigation.

-vishal

2009/12/16 Robert Ferrell <email address hidden>:
> I get the error when I 'import file1'.  If I '%run file1' there is no
> problem.
>
> A bit more specific:
>
> file1.py
> ==========================================
> import IPython
> from IPython.kernel import client
> print 'Imported client'
> tc = client.TaskClient()
> print 'Got client'
> ==========================================
>
> file2.py
> ==========================================
> print 'In file 2'
> import file1
> print 'Imported file1'
> ==========================================
>
> At the shell (not inside ipython),
> $python file1.py
> works fine
> $python file2.py
> hangs.
>
> The situation is similar inside an ipython shell.  %run file1 works
> fine.  import file1 hangs.  %run file2 hangs.
>
> I'll see if I can replicate this with the current bazaar checkout.  I'm
> on Snow Leopard, so things feel a little fragile for me.  (I backed down
> from 0.11 because of some other problem.)
>
> --
> importing client.TaskClient() hangs
> https://bugs.launchpad.net/bugs/497419
> You received this bug notification because you are a member of IPython
> Developers, which is subscribed to IPython.
>
> Status in IPython - Enhanced Interactive Python: New
>
> Bug description:
> If I start an interactive session and type:
>
> import IPython
> from IPython.kernel import client
> tc = client.TaskClient()
>
> at the prompt, I get going fine.  If I put those commands in a file
> and run them as a script, that's fine.  But, if I put them in a file
> and import the file into an interactive IPython session, it hangs when
> I try to get a TaskClient.
>
> This is on OS X 10.6,  Python 2.6.1, ipython 0.10.
>
>
>

Revision history for this message
Robert Ferrell (ferrell) wrote :

Getting an import error with the current bazaar checkout. IPython.kernel.magic is looking for IPython.core.shell, but no such file.

Traceback (most recent call last):
  File "/Users/Shared/Develop/Sandbox/ipy-parallel/file1.py", line 3, in <module>
    from IPython.kernel import client
  File "/Users/Shared/SW-Installers/Sandbox/ipython-bzr/ipython/IPython/kernel/client.py", line 44, in <module>
    import IPython.kernel.magic
  File "/Users/Shared/SW-Installers/Sandbox/ipython-bzr/ipython/IPython/kernel/magic.py", line 21, in <module>
    from IPython.core.shell import MTInteractiveShell
ImportError: No module named shell

Should I make a new bug report for this?

Revision history for this message
Fernando Perez (fdo.perez) wrote :

Hey Brian,

On Wed, Dec 16, 2009 at 9:39 AM, Robert Ferrell <email address hidden> wrote:
> Getting an import error with the current bazaar checkout.
> IPython.kernel.magic is looking for IPython.core.shell, but no such
> file.
>
> Traceback (most recent call last):
>  File "/Users/Shared/Develop/Sandbox/ipy-parallel/file1.py", line 3, in <module>
>    from IPython.kernel import client
>  File "/Users/Shared/SW-Installers/Sandbox/ipython-bzr/ipython/IPython/kernel/client.py", line 44, in <module>
>    import IPython.kernel.magic
>  File "/Users/Shared/SW-Installers/Sandbox/ipython-bzr/ipython/IPython/kernel/magic.py", line 21, in <module>
>    from IPython.core.shell import MTInteractiveShell
> ImportError: No module named shell
>
> Should I make a new bug report for this?

Do you know off the top of your head if this is fixed in the branch
pending review?

If so, we can hold off on this: Brian and I will review and finish up
that branch over the next few days (hopefully this weekend).

Cheers,

f

Revision history for this message
Vishal Vatsa (vvatsa) wrote :

I think that is fixed in the review branch.

-vishal

On Dec 16, 2009 6:10 PM, "Fernando Perez" <email address hidden> wrote:

Hey Brian,

On Wed, Dec 16, 2009 at 9:39 AM, Robert Ferrell <email address hidden>
wrote: > Getting an import...
Do you know off the top of your head if this is fixed in the branch
pending review?

If so, we can hold off on this: Brian and I will review and finish up
that branch over the next few days (hopefully this weekend).

Cheers,

f -- importing client.TaskClient() hangs
https://bugs.launchpad.net/bugs/497419 You received this...

Revision history for this message
Brian Granger (ellisonbg) wrote :

Yes, this is fixed in my branch that is posted for review. All the
parallel computing stuff is broken in trunk
right now (hence my branch :)

But this issue does need to be investigated. It might have something
to do with how we start the Twisted event loop
in the interactive session.

Cheers,

Brian

On Wed, Dec 16, 2009 at 10:03 AM, Fernando Perez <email address hidden> wrote:
> Hey Brian,
>
> On Wed, Dec 16, 2009 at 9:39 AM, Robert Ferrell <email address hidden> wrote:
>> Getting an import error with the current bazaar checkout.
>> IPython.kernel.magic is looking for IPython.core.shell, but no such
>> file.
>>
>> Traceback (most recent call last):
>>  File "/Users/Shared/Develop/Sandbox/ipy-parallel/file1.py", line 3, in <module>
>>    from IPython.kernel import client
>>  File "/Users/Shared/SW-Installers/Sandbox/ipython-bzr/ipython/IPython/kernel/client.py", line 44, in <module>
>>    import IPython.kernel.magic
>>  File "/Users/Shared/SW-Installers/Sandbox/ipython-bzr/ipython/IPython/kernel/magic.py", line 21, in <module>
>>    from IPython.core.shell import MTInteractiveShell
>> ImportError: No module named shell
>>
>> Should I make a new bug report for this?
>
> Do you know off the top of your head if this is fixed in the branch
> pending review?
>
> If so, we can hold off on this: Brian and I will review and finish up
> that branch over the next few days (hopefully this weekend).
>
> Cheers,
>
> f
>
> --
> importing client.TaskClient() hangs
> https://bugs.launchpad.net/bugs/497419
> You received this bug notification because you are a member of IPython
> Developers, which is subscribed to IPython.
>
> Status in IPython - Enhanced Interactive Python: New
>
> Bug description:
> If I start an interactive session and type:
>
> import IPython
> from IPython.kernel import client
> tc = client.TaskClient()
>
> at the prompt, I get going fine.  If I put those commands in a file
> and run them as a script, that's fine.  But, if I put them in a file
> and import the file into an interactive IPython session, it hangs when
> I try to get a TaskClient.
>
> This is on OS X 10.6,  Python 2.6.1, ipython 0.10.
>
>
>

--
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
<email address hidden>
<email address hidden>

Revision history for this message
Fernando Perez (fdo.perez) wrote :

On Wed, Dec 16, 2009 at 10:23 AM, Vishal Vatsa <email address hidden> wrote:
> I think that is fixed in the review branch.

Thanks a lot, Vishal. BTW, feel free to pitch in the code review, it
would be great to have your input as well there. I'm sorry I've been
so out of the loop lately, but I know we need this code in trunk ASAP,
so the more eyes we can put on it, the better :)

Cheers,

f

Revision history for this message
Fernando Perez (fdo.perez) wrote :

Closing, since all that code got merged.

Changed in ipython:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.