A module that makes multiprocessing easy.
Project description
mplite
A light weight wrapper for pythons multiprocessing module that makes multiprocessing easy.
In case anyone is looking for a very easy way to use multiprocessing with args and kwargs, here is a neat wrapper as mplite:
The test is also the showcase:
from mplite import TaskManager, Task
import time
# first create the function that each cpu should work on individually.
def f(*args, **kwargs):
print(args, kwargs)
time.sleep(args[0])
return args[0]
# Next create the main function you'd like to run everything from:
def main():
tasks = [] # create a tasklist and populate it with tasks
for n in list(range(10))*5:
t = Task(f, *(n/10,), **{'hello': n})
tasks.append(t)
with TaskManager() as tm:
results = tm.execute(tasks)
if __name__ == "__main__":
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mplite-1.0.2.tar.gz
(3.7 kB
view hashes)