[IPython-dev] question about KernelClient.is_alive()

Lev Givon lev at columbia.edu
Sun Jan 18 11:43:19 EST 2015


Received from Lev Givon on Sun, Jan 18, 2015 at 08:28:55AM EST:
> I recently tried using IPython.kernel.KernelClient (in IPython 2.3.1 on Ubuntu
> 14.04.1) to connect to a locally running kernel (started from the command line
> by running "ipython kernel") by passing it the connection file associated with
> the latter. While doing so, I noticed that KernelClient.is_alive() returns True
> even when KernelClient is instantiated with a nonexistent connection file, i.e.,
> 
> import IPython.kernel
> kc = IPython.kernel.KernelClient(connection_file='/tmp/nonexistent_file')
> print kc.is_alive()
> 
> Is this expected? The online documentation seems to imply that is_alive() should
> return True only if the kernel to which KernelClient is connected is running.

(Answering my own question for the benefit of others.)

The value of KernelClient.is_alive() evidently isn't indicative of actual kernel
status until the heartbeat channel is activated and unpaused to determine
whether the client is interacting with a live kernel.
-- 
Lev Givon
Bionet Group | Neurokernel Project
http://www.columbia.edu/~lev/
http://lebedov.github.io/
http://neurokernel.github.io/




More information about the IPython-dev mailing list