ipython/ipython — pull request #1768 by minrk (2012-05-27 22:02:28+00:00)
Title: Update parallel magics

I've updated the parallel magics, so they display more than just stdout. They now display *all* output, so you can do parallel plotting, and everything:

![px plot](https://img.skitch.com/20120527-mjgwf48uc7k8jf3cfirus6cshe.png)

I need to do a pass on the docs to reflect this change and update a couple of tests before it gets in, but it's pretty much there already.

A largely aesthetic question:

The output is displayed in-order:

1. engine stdout printed to stdout with '[stdout:eid]' prefix
2. engine stderr printed to stderr with '[stderr:eid]' prefix
3. displaypub outputs per-engine
4. pyout for each engine

Alternatives:

1. go through the whole shebang for each engine (so stdout/err/output/pyout are contiguous per engine).
2. collate displaypub, so if there is a sequence of plots from each engine, the plots would go together.

Anyone have a preference on these, or still other options?

An example function that publishes on all channels:

```python
In [9]: def test_outputs():
...: print >> sys.stderr, "err"
...: print "stdout"
...: display(5)
...: print >> sys.stderr, "err again"
...: display('hello displaypub')
...: print "out again"
...: return "return value"

In [10]: dv['test_outputs'] = test_outputs

In [11]: %px test_outputs()
Parallel execution on engine(s): [0, 1]
[stdout: 0] stdout
out again
[stdout: 1] stdout
out again
[stderr: 0] err
err again
[stderr: 1] err
err again
5
'hello displaypub'
5
'hello displaypub'
[ 0] Out[15]: 'return value'
[ 1] Out[15]: 'return value'

In [12]:
```