Module: parallel.client.remotefunction — IPython 2.3.1 documentation

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »

# Module: `parallel.client.remotefunction`

Remote Functions and decorators for Views.

## 2 Classes

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)

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 the result should be kept in order. If False, results become available as they arrive, regardless of submission order. **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 one or more sequence(s) remotely. This should behave very much like the builtin map, but return an AsyncMapResult if self.block is False.

    That means it can take generators (will be cast to lists locally), and mismatched sequence lengths will be padded with None.

## 4 Functions

`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

`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.` `getname`(f)

  Get the name of an object.

  For use in case of callables that are not functions, and thus may not have __name__ defined.

  Order: f.__name__ > f.name > str(f)

`IPython.parallel.client.remotefunction.` `sync_view_results`(f)

  sync relevant results from self.client to our results attribute.

  This is a clone of view.sync_results, but for remote functions

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »