In [3]:
from IPython import parallel

In [4]:
rc = parallel.Client()
rc.block=True
rc.ids


Out[4]:
[]

In [5]:
def mul(a,b):
    return a*b

In [6]:
rc[0].apply(mul,5,6)


Out[6]:
30

In [7]:
rc[:].apply(mul,5,6)


Out[7]:
[30, 30, 30, 30]

In [8]:
print range(1,10)
print range(2,11)
map(mul, range(1,10), range(2,11))


[1, 2, 3, 4, 5, 6, 7, 8, 9]
[2, 3, 4, 5, 6, 7, 8, 9, 10]
Out[8]:
[2, 6, 12, 20, 30, 42, 56, 72, 90]

In [9]:
view = rc.load_balanced_view()
view.map(mul, range(1,10), range(2,11))


Out[9]:
[2, 6, 12, 20, 30, 42, 56, 72, 90]

In [10]:
# to keep packages imported
e0=rc[0]
with e0.sync_imports():
    import numpy


importing numpy on engine(s)

In [11]:
def numpytest(a):
    x=numpy.array([a,a])
    return x

In [12]:
e0.apply(numpytest,3)


Out[12]:
array([3, 3])

In [13]:
e0.push(dict(a=1.03, b=3.48))

In [14]:
e0['c']=100

In [15]:
e0.pull(['b','a','c'])


Out[15]:
[3.48, 1.03, 100]

In [ ]: