~ubuntu-branches/ubuntu/raring/ipython/raring

« back to all changes in this revision

Viewing changes to docs/examples/newparallel/taskmap.py

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2011-11-22 23:40:57 UTC
  • mfrom: (6.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20111122234057-ta86ocdahnhwmnd8
Tags: 0.11-2
* upload to unstable
* add patch fix-version-checks-for-pyzmq-2.1.10.patch
* fix debianize-error-messages.patch to reraise unknown exceptions
* suggest python-zmq for ipython package
* use dh_sphinxdoc
  - bump sphinx dependency to >= 1.0.7+dfsg-1~, replace libjs-jquery
    dependency with ${sphinxdoc:Depends} and drop ipython-doc.links
* remove empty directory from ipython
* link duplicate images in ipython-doc
* remove obsolete Conflicts and Replaces

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from IPython.parallel import Client
 
2
 
 
3
rc = Client()
 
4
v = rc.load_balanced_view()
 
5
 
 
6
result = v.map(lambda x: 2*x, range(10))
 
7
print "Simple, default map: ", list(result)
 
8
 
 
9
ar = v.map_async(lambda x: 2*x, range(10))
 
10
print "Submitted tasks, got ids: ", ar.msg_ids
 
11
result = ar.get()
 
12
print "Using a mapper: ", result
 
13
 
 
14
@v.parallel(block=True)
 
15
def f(x): return 2*x
 
16
 
 
17
result = f.map(range(10))
 
18
print "Using a parallel function: ", result
 
 
b'\\ No newline at end of file'