external Package — cobra 0.2.0 documentation

### Navigation

- index
- modules |
- next |
- previous |
- cobra 0.2.0 documentation »
- cobra Package »

# external Package

## `ppmap` Module

Very basic parallel processing support

Implements a work-alike of the builtin map() function that distributes work across many processes. As it uses Parallel Python to do the actual multi-processing, code using this must conform to the usual PP restrictions (arguments must be serializable, etc.)

`cobra.external.ppmap.` `ppmap`(processes, function, sequence, *sequences)

  Split the work of ‘function’ across the given number of processes. Set ‘processes’ to None to let Parallel Python autodetect the number of children to use.

  Although the calling semantics should be identical to __builtin__.map (even using __builtin__.map to process arguments), it differs in that it returns a generator instead of a list. This enables lazy evaluation of the results so that other work can be done while the subprocesses are still running.

      >>> def rangetotal(n): return n, sum(range(n))
      >>> list(map(rangetotal, range(1, 6)))
      [(1, 0), (2, 1), (3, 3), (4, 6), (5, 10)]
      >>> list(ppmap(1, rangetotal, range(1, 6)))
      [(1, 0), (2, 1), (3, 3), (4, 6), (5, 10)]

### Navigation

- index
- modules |
- next |
- previous |
- cobra 0.2.0 documentation »
- cobra Package »