Show More
@@ -2,6 +2,8 b'' | |||||
2 | Notes on the IPython configuration system |
|
2 | Notes on the IPython configuration system | |
3 | ========================================= |
|
3 | ========================================= | |
4 |
|
4 | |||
|
5 | This document has some random notes on the configuration system. | |||
|
6 | ||||
5 | To start, an IPython process needs: |
|
7 | To start, an IPython process needs: | |
6 |
|
8 | |||
7 | * Configuration files |
|
9 | * Configuration files |
@@ -6,27 +6,50 b' IPython.kernel.core.notification blueprint' | |||||
6 |
|
6 | |||
7 | Overview |
|
7 | Overview | |
8 | ======== |
|
8 | ======== | |
9 | The :mod:`IPython.kernel.core.notification` module will provide a simple implementation of a notification center and support for the observer pattern within the :mod:`IPython.kernel.core`. The main intended use case is to provide notification of Interpreter events to an observing frontend during the execution of a single block of code. |
|
9 | ||
|
10 | The :mod:`IPython.kernel.core.notification` module will provide a simple | |||
|
11 | implementation of a notification center and support for the observer pattern | |||
|
12 | within the :mod:`IPython.kernel.core`. The main intended use case is to | |||
|
13 | provide notification of Interpreter events to an observing frontend during the | |||
|
14 | execution of a single block of code. | |||
10 |
|
15 | |||
11 | Functional Requirements |
|
16 | Functional Requirements | |
12 | ======================= |
|
17 | ======================= | |
|
18 | ||||
13 | The notification center must: |
|
19 | The notification center must: | |
14 | * Provide synchronous notification of events to all registered observers. |
|
20 | ||
15 | * Provide typed or labeled notification types |
|
21 | * Provide synchronous notification of events to all registered observers. | |
16 | * Allow observers to register callbacks for individual or all notification types |
|
22 | ||
17 | * Allow observers to register callbacks for events from individual or all notifying objects |
|
23 | * Provide typed or labeled notification types. | |
18 | * Notification to the observer consists of the notification type, notifying object and user-supplied extra information [implementation: as keyword parameters to the registered callback] |
|
24 | ||
19 | * Perform as O(1) in the case of no registered observers. |
|
25 | * Allow observers to register callbacks for individual or all notification | |
20 | * Permit out-of-process or cross-network extension. |
|
26 | types. | |
|
27 | ||||
|
28 | * Allow observers to register callbacks for events from individual or all | |||
|
29 | notifying objects. | |||
|
30 | ||||
|
31 | * Notification to the observer consists of the notification type, notifying | |||
|
32 | object and user-supplied extra information [implementation: as keyword | |||
|
33 | parameters to the registered callback]. | |||
|
34 | ||||
|
35 | * Perform as O(1) in the case of no registered observers. | |||
|
36 | ||||
|
37 | * Permit out-of-process or cross-network extension. | |||
21 |
|
38 | |||
22 | What's not included |
|
39 | What's not included | |
23 | ============================================================== |
|
40 | =================== | |
|
41 | ||||
24 | As written, the :mod:`IPython.kernel.core.notificaiton` module does not: |
|
42 | As written, the :mod:`IPython.kernel.core.notificaiton` module does not: | |
25 | * Provide out-of-process or network notifications [these should be handled by a separate, Twisted aware module in :mod:`IPython.kernel`]. |
|
43 | ||
26 | * Provide zope.interface-style interfaces for the notification system [these should also be provided by the :mod:`IPython.kernel` module] |
|
44 | * Provide out-of-process or network notifications (these should be handled by | |
|
45 | a separate, Twisted aware module in :mod:`IPython.kernel`). | |||
|
46 | ||||
|
47 | * Provide zope.interface-style interfaces for the notification system (these | |||
|
48 | should also be provided by the :mod:`IPython.kernel` module). | |||
27 |
|
49 | |||
28 | Use Cases |
|
50 | Use Cases | |
29 | ========= |
|
51 | ========= | |
|
52 | ||||
30 | The following use cases describe the main intended uses of the notificaiton module and illustrate the main success scenario for each use case: |
|
53 | The following use cases describe the main intended uses of the notificaiton module and illustrate the main success scenario for each use case: | |
31 |
|
54 | |||
32 | 1. Dwight Schroot is writing a frontend for the IPython project. His frontend is stuck in the stone age and must communicate synchronously with an IPython.kernel.core.Interpreter instance. Because code is executed in blocks by the Interpreter, Dwight's UI freezes every time he executes a long block of code. To keep track of the progress of his long running block, Dwight adds the following code to his frontend's set-up code:: |
|
55 | 1. Dwight Schroot is writing a frontend for the IPython project. His frontend is stuck in the stone age and must communicate synchronously with an IPython.kernel.core.Interpreter instance. Because code is executed in blocks by the Interpreter, Dwight's UI freezes every time he executes a long block of code. To keep track of the progress of his long running block, Dwight adds the following code to his frontend's set-up code:: | |
@@ -40,9 +63,20 b' The following use cases describe the main intended uses of the notificaiton modu' | |||||
40 | def stdout_notification(self, type, notifying_object, out_string=None): |
|
63 | def stdout_notification(self, type, notifying_object, out_string=None): | |
41 | self.writeStdOut(out_string) |
|
64 | self.writeStdOut(out_string) | |
42 |
|
65 | |||
43 | If everything works, the Interpreter will (according to its published API) fire a notification via the :data:`IPython.kernel.core.notification.sharedCenter` of type :const:`STD_OUT_NOTIFICATION_TYPE` before writing anything to stdout [it's up to the Intereter implementation to figure out when to do this]. The notificaiton center will then call the registered callbacks for that event type (in this case, Dwight's frontend's stdout_notification method). Again, according to its API, the Interpreter provides an additional keyword argument when firing the notificaiton of out_string, a copy of the string it will write to stdout. |
|
66 | If everything works, the Interpreter will (according to its published API) | |
|
67 | fire a notification via the | |||
|
68 | :data:`IPython.kernel.core.notification.sharedCenter` of type | |||
|
69 | :const:`STD_OUT_NOTIFICATION_TYPE` before writing anything to stdout [it's up | |||
|
70 | to the Intereter implementation to figure out when to do this]. The | |||
|
71 | notificaiton center will then call the registered callbacks for that event | |||
|
72 | type (in this case, Dwight's frontend's stdout_notification method). Again, | |||
|
73 | according to its API, the Interpreter provides an additional keyword argument | |||
|
74 | when firing the notificaiton of out_string, a copy of the string it will write | |||
|
75 | to stdout. | |||
44 |
|
76 | |||
45 |
|
|
77 | Like magic, Dwight's frontend is able to provide output, even during | |
|
78 | long-running calculations. Now if Jim could just convince Dwight to use | |||
|
79 | Twisted... | |||
46 |
|
80 | |||
47 | 2. Boss Hog is writing a frontend for the IPython project. Because Boss Hog is stuck in the stone age, his frontend will be written in a new Fortran-like dialect of python and will run only from the command line. Because he doesn't need any fancy notification system and is used to worrying about every cycle on his rat-wheel powered mini, Boss Hog is adamant that the new notification system not produce any performance penalty. As they say in Hazard county, there's no such thing as a free lunch. If he wanted zero overhead, he should have kept using IPython 0.8. Instead, those tricky Duke boys slide in a suped-up bridge-out jumpin' awkwardly confederate-lovin' notification module that imparts only a constant (and small) performance penalty when the Interpreter (or any other object) fires an event for which there are no registered observers. Of course, the same notificaiton-enabled Interpreter can then be used in frontends that require notifications, thus saving the IPython project from a nasty civil war. |
|
81 | 2. Boss Hog is writing a frontend for the IPython project. Because Boss Hog is stuck in the stone age, his frontend will be written in a new Fortran-like dialect of python and will run only from the command line. Because he doesn't need any fancy notification system and is used to worrying about every cycle on his rat-wheel powered mini, Boss Hog is adamant that the new notification system not produce any performance penalty. As they say in Hazard county, there's no such thing as a free lunch. If he wanted zero overhead, he should have kept using IPython 0.8. Instead, those tricky Duke boys slide in a suped-up bridge-out jumpin' awkwardly confederate-lovin' notification module that imparts only a constant (and small) performance penalty when the Interpreter (or any other object) fires an event for which there are no registered observers. Of course, the same notificaiton-enabled Interpreter can then be used in frontends that require notifications, thus saving the IPython project from a nasty civil war. | |
48 |
|
82 |
@@ -6,97 +6,68 b' Development roadmap' | |||||
6 |
|
6 | |||
7 | IPython is an ambitious project that is still under heavy development. However, we want IPython to become useful to as many people as possible, as quickly as possible. To help us accomplish this, we are laying out a roadmap of where we are headed and what needs to happen to get there. Hopefully, this will help the IPython developers figure out the best things to work on for each upcoming release. |
|
7 | IPython is an ambitious project that is still under heavy development. However, we want IPython to become useful to as many people as possible, as quickly as possible. To help us accomplish this, we are laying out a roadmap of where we are headed and what needs to happen to get there. Hopefully, this will help the IPython developers figure out the best things to work on for each upcoming release. | |
8 |
|
8 | |||
9 | Speaking of releases, we are going to begin releasing a new version of IPython every four weeks. We are hoping that a regular release schedule, along with a clear roadmap of where we are headed will propel the project forward. |
|
9 | Work targeted to particular releases | |
|
10 | ==================================== | |||
10 |
|
11 | |||
11 | Where are we headed |
|
12 | Release 0.10 | |
12 | =================== |
|
13 | ------------ | |
13 |
|
||||
14 | Our goal with IPython is simple: to provide a *powerful*, *robust* and *easy to use* framework for parallel computing. While there are other secondary goals you will hear us talking about at various times, this is the primary goal of IPython that frames the roadmap. |
|
|||
15 |
|
||||
16 | Steps along the way |
|
|||
17 | =================== |
|
|||
18 |
|
||||
19 | Here we describe the various things that we need to work on to accomplish this goal. |
|
|||
20 |
|
||||
21 | Setting up for regular release schedule |
|
|||
22 | --------------------------------------- |
|
|||
23 |
|
||||
24 | We would like to begin to release IPython regularly (probably a 4 week release cycle). To get ready for this, we need to revisit the development guidelines and put in information about releasing IPython. |
|
|||
25 |
|
14 | |||
26 | Process startup and management |
|
15 | * Initial refactor of :command:`ipcluster`. | |
27 | ------------------------------ |
|
|||
28 |
|
16 | |||
29 | IPython is implemented using a distributed set of processes that communicate using TCP/IP network channels. Currently, users have to start each of the various processes separately using command line scripts. This is both difficult and error prone. Furthermore, there are a number of things that often need to be managed once the processes have been started, such as the sending of signals and the shutting down and cleaning up of processes. |
|
17 | * Better TextMate integration. | |
30 |
|
18 | |||
31 | We need to build a system that makes it trivial for users to start and manage IPython processes. This system should have the following properties: |
|
19 | Release 0.11 | |
|
20 | ------------ | |||
32 |
|
21 | |||
33 | * It should possible to do everything through an extremely simple API that |
|
22 | * Refactor of configuration system and command line options for | |
34 | users can call from their own Python script. No shell commands should be |
|
23 | :command:`ipengine` and :command:`ipcontroller`. This will include the | |
35 | needed. |
|
24 | creation of cluster directories that encapsulate all the configuration | |
36 | * This simple API should be configured using standard .ini files. |
|
25 | files, log files and security related files for a particular cluster. | |
37 | * The system should make it possible to start processes using a number of |
|
|||
38 | different approaches: SSH, PBS/Torque, Xgrid, Windows Server, mpirun, etc. |
|
|||
39 | * The controller and engine processes should each have a daemon for |
|
|||
40 | monitoring, signaling and clean up. |
|
|||
41 | * The system should be secure. |
|
|||
42 | * The system should work under all the major operating systems, including |
|
|||
43 | Windows. |
|
|||
44 |
|
26 | |||
45 | Initial work has begun on the daemon infrastructure, and some of the needed logic is contained in the ipcluster script. |
|
27 | * Merge in the daemon branch. | |
46 |
|
28 | |||
47 | Ease of use/high-level approaches to parallelism |
|
29 | * Merge back in the core of the notebook. | |
48 | ------------------------------------------------ |
|
|||
49 |
|
30 | |||
50 | While our current API for clients is well designed, we can still do a lot better in designing a user-facing API that is super simple. The main goal here is that it should take *almost no extra code* for users to get their code running in parallel. For this to be possible, we need to tie into Python's standard idioms that enable efficient coding. The biggest ones we are looking at are using context managers (i.e., Python 2.5's ``with`` statement) and decorators. Initial work on this front has begun, but more work is needed. |
|
31 | Release 0.12 | |
|
32 | ------------ | |||
51 |
|
33 | |||
52 | We also need to think about new models for expressing parallelism. This is fun work as most of the foundation has already been established. |
|
34 | * Integrate process startup with the daemons for full process management. | |
53 |
|
35 | |||
54 | Security |
|
36 | Major areas of work | |
55 | -------- |
|
37 | =================== | |
56 |
|
||||
57 | Currently, IPython has no built in security or security model. Because we would like IPython to be usable on public computer systems and over wide area networks, we need to come up with a robust solution for security. Here are some of the specific things that need to be included: |
|
|||
58 |
|
||||
59 | * User authentication between all processes (engines, controller and clients). |
|
|||
60 | * Optional TSL/SSL based encryption of all communication channels. |
|
|||
61 | * A good way of picking network ports so multiple users on the same system can |
|
|||
62 | run their own controller and engines without interfering with those of |
|
|||
63 | others. |
|
|||
64 | * A clear model for security that enables users to evaluate the security risks |
|
|||
65 | associated with using IPython in various manners. |
|
|||
66 |
|
||||
67 | For the implementation of this, we plan on using Twisted's support for SSL and authentication. One things that we really should look at is the `Foolscap`_ network protocol, which provides many of these things out of the box. |
|
|||
68 |
|
38 | |||
69 | .. _Foolscap: http://foolscap.lothar.com/trac |
|
39 | Refactoring the main IPython core | |
|
40 | --------------------------------- | |||
70 |
|
41 | |||
71 | The security work needs to be done in conjunction with other network protocol stuff. |
|
42 | Process management for :mod:`IPython.kernel` | |
|
43 | -------------------------------------------- | |||
72 |
|
44 | |||
73 | As of the 0.9 release of IPython, we are using Foolscap and we have implemented |
|
45 | Configuration system | |
74 | a full security model. |
|
46 | -------------------- | |
75 |
|
47 | |||
76 | Latent performance issues |
|
48 | Performance problems | |
77 |
-------------------- |
|
49 | -------------------- | |
78 |
|
50 | |||
79 | Currently, we have a number of performance issues that are waiting to bite users: |
|
51 | Currently, we have a number of performance issues that are waiting to bite users: | |
80 |
|
52 | |||
81 | * The controller store a large amount of state in Python dictionaries. Under |
|
53 | * The controller stores a large amount of state in Python dictionaries. Under | |
82 | heavy usage, these dicts with get very large, causing memory usage problems. |
|
54 | heavy usage, these dicts with get very large, causing memory usage problems. | |
83 | We need to develop more scalable solutions to this problem, such as using a |
|
55 | We need to develop more scalable solutions to this problem, such as using a | |
84 | sqlite database to store this state. This will also help the controller to |
|
56 | sqlite database to store this state. This will also help the controller to | |
85 | be more fault tolerant. |
|
57 | be more fault tolerant. | |
86 | * Currently, the client to controller connections are done through XML-RPC |
|
58 | ||
87 | using HTTP 1.0. This is very inefficient as XML-RPC is a very verbose |
|
|||
88 | protocol and each request must be handled with a new connection. We need to |
|
|||
89 | move these network connections over to PB or Foolscap. Done! |
|
|||
90 | * We currently don't have a good way of handling large objects in the |
|
59 | * We currently don't have a good way of handling large objects in the | |
91 | controller. The biggest problem is that because we don't have any way of |
|
60 | controller. The biggest problem is that because we don't have any way of | |
92 | streaming objects, we get lots of temporary copies in the low-level buffers. |
|
61 | streaming objects, we get lots of temporary copies in the low-level buffers. | |
93 | We need to implement a better serialization approach and true streaming |
|
62 | We need to implement a better serialization approach and true streaming | |
94 | support. |
|
63 | support. | |
|
64 | ||||
95 | * The controller currently unpickles and repickles objects. We need to use the |
|
65 | * The controller currently unpickles and repickles objects. We need to use the | |
96 | [push|pull]_serialized methods instead. |
|
66 | [push|pull]_serialized methods instead. | |
97 | * Currently the controller is a bottleneck. We need the ability to scale the |
|
67 | ||
98 | controller by aggregating multiple controllers into one effective |
|
68 | * Currently the controller is a bottleneck. The best approach for this is to | |
99 | controller. |
|
69 | separate the controller itself into multiple processes, one for the core | |
|
70 | controller and one each for the controller interfaces. | |||
100 |
|
71 | |||
101 |
|
72 | |||
102 |
|
73 |
General Comments 0
You need to be logged in to leave comments.
Login now