[IPython-dev] about ipython-zmq
Sun Jul 25 16:38:57 CDT 2010
2010/7/24 Fernando Perez <firstname.lastname@example.org>
> Hi Omar,
> 2010/7/24 Omar Andrés Zapata Mesa <email@example.com>:
> > .
> > Let's suppose the following code in the prompt:
> > In : for i in range(100000):
> > ...: print i
> > ...:
> > This will take a lot of time to run, and if the user wants to stop the
> > process he will normally do it with ctrl+c.
> > by capturing KeyboardInterrupt i was experimenting with a message sent to
> > the kernel to stop such process, but the kernel hangs until the "for"
> > process is over.
> > The solution I see is to run the kernel processes on a thread. what do
> > think?
> No, the kernel will be in a separate process, and what needs to be done is:
> 1. capture Ctrl-C in the frontend side with the usual try/except.
> 2. Send the Ctrl-C as a signal to the kernel process.
I think it is a little dangerous to forward Ctrl-C. When there are two
processes like this I think it is very ambiguous as to what it means. I
would rather go with a frontend magic:
:kernel 0 kill
> In order to do this, you'll need to know the PID of the kernel
> process, but Evan has already been making progress in this direction
> so you can benefit from his work. This code:
> already has a kernel launcher prototype with the necessary PID information.
Let's start to use the Popen interface of Python 2.6. It has a terminate
and kill method that gets around the PID stuf in a cross platform manner.
> To send the signal, you can use os.kill for now. This has problems
> on Windows, but let's get signal handling working on *nix first and
> once things are in place nicely, we'll look into more general options.
> > And another question:
> > What magi commands do you think ipython-zmq should have?
> For now don't worry about magics, as they should all happen
> kernel-wise for you. I'll send an email regarding some ideas about
> magics separately shortly.
> IPython-dev mailing list
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev