IPython Documentation

Table Of Contents

Previous topic

parallel.client.map

Next topic

parallel.client.view

This Page

parallel.client.remotefunction

Module: parallel.client.remotefunction

Inheritance diagram for IPython.parallel.client.remotefunction:

Remote Functions and decorators for Views.

Authors:

  • Brian Granger
  • Min RK

Classes

ParallelFunction

class IPython.parallel.client.remotefunction.ParallelFunction(view, f, dist='b', block=None, chunksize=None, ordered=True, **flags)

Bases: IPython.parallel.client.remotefunction.RemoteFunction

Class for mapping a function to sequences.

This will distribute the sequences according the a mapper, and call the function on each sub-sequence. If called via map, then the function will be called once on each element, rather that each sub-sequence.

Parameters :

view : View instance

The view to be used for execution

f : callable

The function to be wrapped into a remote function

dist : str [default: ‘b’]

The key for which mapObject to use to distribute sequences options are:

  • ‘b’ : use contiguous chunks in order
  • ‘r’ : use round-robin striping

block : bool [default: None]

Whether to wait for results or not. The default behavior is to use the current block attribute of view

chunksize : int or None

The size of chunk to use when breaking up sequences in a load-balanced manner

ordered : bool [default: True]

Whether

**flags : remaining kwargs are passed to View.temp_flags

__init__(view, f, dist='b', block=None, chunksize=None, ordered=True, **flags)
map(*sequences)

call a function on each element of a sequence remotely. This should behave very much like the builtin map, but return an AsyncMapResult if self.block is False.

RemoteFunction

class IPython.parallel.client.remotefunction.RemoteFunction(view, f, block=None, **flags)

Bases: object

Turn an existing function into a remote function.

Parameters :

view : View instance

The view to be used for execution

f : callable

The function to be wrapped into a remote function

block : bool [default: None]

Whether to wait for results or not. The default behavior is to use the current block attribute of view

**flags : remaining kwargs are passed to View.temp_flags

__init__(view, f, block=None, **flags)

Functions

IPython.parallel.client.remotefunction.parallel(view, dist='b', block=None, ordered=True, **flags)

Turn a function into a parallel remote function.

This method can be used for map:

In [1]: @parallel(view, block=True)
...: def func(a): ...: pass
IPython.parallel.client.remotefunction.remote(view, block=None, **flags)

Turn a function into a remote function.

This method can be used for map:

In [1]: @remote(view,block=True)
...: def func(a): ...: pass