IPython’s execution in a command-line environment will be ported to a two process model using the zeromq library for inter-process communication. this will:
Currently IPython provides a command-line client that executes all code in a single process, and a set of tools for distributed and parallel computing that execute code in multiple processes (possibly but not necessarily on different hosts), using the twisted asynchronous framework for communication between nodes. for a number of reasons, it is desirable to unify the architecture of the local execution with that of distributed computing, since ultimately many of the underlying abstractions are similar and should be reused. in particular, we would like to:
As part of the zmq python bindings, the IPython developers have already developed a simple prototype of such a two-process kernel/frontend system (details below). I propose to start from this example and port today’s IPython code to operate in a similar manner. IPython’s command-line program (the main ‘ipython’ script) executes both user interaction and the user’s code in the same process. This project will thus require breaking up IPython into the parts that correspond to the kernel and the parts that are meant to interact with the user, and making these two components communicate over the network using zmq instead of accessing local attributes and methods of a single global object.
Once this port is complete, the resulting tools will be the foundation (though as part of this proposal i do not expect to undertake either of these tasks) to allow the distributed computing parts of IPython to use the same code as the command-line client, and for the whole system to be ported to python3. so while i do not intend to tackle here the removal of twisted and the unification of the local and distributed parts of IPython, my proposal is a necessary step before those are possible.
As part of the zeromq bindings, the IPython developers have already developed a simple prototype example that provides a python execution kernel (with none of IPython’s code or features, just plain code execution) that listens on zmq sockets, and a frontend based on the interactiveconsole class of the code.py module from the python standard library. this example is capable of executing code, propagating errors, performing tab-completion over the network and having multiple frontends connect and disconnect simultaneously to a single kernel, with all inputs and outputs being made available to all connected clients (thanks to zqm’s pub sockets that provide multicasting capabilities for the kernel and to which the frontends subscribe via a sub socket).
We have all example code in:
all of this code already works, and can be seen in this example directory from the zmq python bindings:
Based on this work, i expect to write a stable system for IPython kernel with IPython standards, error control,crash recovery system and general configuration options, also standardize defaults ports or auth system for remote connection etc.
The crash recovery system, is a IPython kernel module for when it fails unexpectedly, you can retrieve the information from the section, this will be based on a log and a lock file to indicate when the kernel was not closed in a proper way.