Skip to main content

a set utilities that ake advantage of python's 'multiprocessing' module to distribute CPU-intensive tasks

Project description

# Para(llel) processing utilities This library implements a simple set of parallel processing utilities that take advantage of python’s multiprocessing module to distribute processing over multiple CPUs on a single machine. The most salient feature of this library is the map() function that can be used to distribute CPU-intensive processing of a collection of items over multiple cores.

  • Installation pip install para

## Basic usage

>>> import para
>>> import gzip
>>>
>>> items = ["examples/big-file1.gz", "examples/big-file2.gz",
...          "examples/big-file3.gz"]
>>> def log_lines(path):
...     with gzip.open(path, 'rt') as f:
...         for lineno, line in enumerate(f):
...             if len(line) > 50:
...                 yield path, lineno, line
...
>>> for path, lineno, line in para.map(log_lines, items):
...     print(path, lineno, repr(line))
...
examples/big-file1.gz 2 'this line is going to be much longer than 80 chars -- at least I hope it will\n'
examples/big-file3.gz 0 'again with the long lines -- this is going to show up in the output, I hope\n'

## Authors * Aaron Halfaker – https://github.com/halfak

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

para-0.0.4.zip (9.5 kB view details)

Uploaded Source

para-0.0.4.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file para-0.0.4.zip.

File metadata

  • Download URL: para-0.0.4.zip
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for para-0.0.4.zip
Algorithm Hash digest
SHA256 33fb8aed1a2e7b5dbdcd63027a66d61125d20f5491e0a55f57bce61dd74eab89
MD5 e7168be525d4d61a5df4533c5c625ef8
BLAKE2b-256 8ccf11245cffcdb00d6f016a8f9782cea453cc156f73303333899c5a1ffe7d16

See more details on using hashes here.

File details

Details for the file para-0.0.4.tar.gz.

File metadata

  • Download URL: para-0.0.4.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for para-0.0.4.tar.gz
Algorithm Hash digest
SHA256 1847bdbef5470b0f9569a28a30e7d1a087d4ea1457c7dbd6aec72797e5d8c27a
MD5 3514b1dd4dc56ff9577dbf91cf8ae058
BLAKE2b-256 955892f841f65811a477b6edc4af1c0803c99dfb9687763aaea10da52d93ec3d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page