[IPython-User] Pushing Code to Engines?

darren@ontrene... darren@ontrene...
Tue Aug 16 09:21:32 CDT 2011


Hi,
  Thanks for the tip.

Does this approach work for load balanced view? that's what I've been
using
and couldn't get it to work exactly, but I will try again when I get home.

Darren

On Mon, 15 Aug 2011 13:51:29 -0700, MinRK <benjaminrk@gmail.com> wrote:
> To call a function on args remotely, you just use apply:
> 
> rc = Client()
> dview = Client[:]
> 
> def f(a):
>     return a*2
> 
> # call f(5) on every engine:
> dview.apply(f, 5)
> 
> # send f to all engines (as 'g', you can give it any name), so you can
use
> it many times:
> dview['g'] = f
> 
> # now you can call it with execute:
> dview.execute('b=g(10)')
> 
> -MinRK
> 
> On Mon, Aug 15, 2011 at 13:34, Darren Govoni <darren@ontrenet.com>
wrote:
> 
>> Hi,
>>   I have a cluster and create a Client() from ip shell.
>> I define a function in my shell space. Is it possible to have it pushed
>> to the engines to execute? Or does all the code have to reside
>> on the engines already?
>>
>> thanks for any tips. I'm reading all the docs, but missing these
>> particulars.
>>
>> Darren
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
>>


More information about the IPython-User mailing list