Skip to content

Shapeways/py-parallel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyParallel

Build Status

Runs a series of functions in parallel processes. Return values are ordered by the order in which their functions were passed.

val1, val2 = run_parallel([
    lambda: 1 + 1
    lambda: 0])

If an exception is raised within one of the processes, that exception will be caught at the process level and raised by the parent process as an ErrorInProcessException, which will save all errors raised across processes.

You can catch the exception raised for more details into the process exceptions:

try:
    val1, val2 = run_parallel([fn1, fn2])
except ErrorInProcessException, e:
    print e.errors

You can also run using threads or processes:

# Threads
val1, val2 = run_parallel([fn1, fn2])

# Processes
val1, val2 = run_parallel([fn1, fn2], multiprocess=True)

Installation

Using setuptools:

python setup.py install

Using pip:

pip install py-parallel

About

Utility for simple asynchronous function calls

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages