[IPython-User] Pushing Code to Engines?
Tue Aug 16 11:16:05 CDT 2011
Not exactly. Push/execute are not available to the load balanced view (because you don't even know where you pushed to).
If you want to define and push a function locally, you can do that with the direct view. Once you have pushed it, it is available to call from the load balanced view, because 'g' ( in the example below) will be in globals.
On Aug 16, 2011, at 7:21, <firstname.lastname@example.org> wrote:
> Thanks for the tip.
> Does this approach work for load balanced view? that's what I've been
> and couldn't get it to work exactly, but I will try again when I get home.
> On Mon, 15 Aug 2011 13:51:29 -0700, MinRK <email@example.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
>> it many times:
>> dview['g'] = f
>> # now you can call it with execute:
>> On Mon, Aug 15, 2011 at 13:34, Darren Govoni <firstname.lastname@example.org>
>>> 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
>>> IPython-User mailing list
More information about the IPython-User