added worker

This commit is contained in:
Marcel Paffrath 2016-05-23 14:25:06 +02:00
parent 42cbfeb787
commit d9844fff17

View File

@ -450,6 +450,12 @@ def runProgram(cmd, parameter=None):
output = subprocess.check_output('{} | tee /dev/stderr'.format(cmd), output = subprocess.check_output('{} | tee /dev/stderr'.format(cmd),
shell=True) shell=True)
def worker(func, input, cores):
from multiprocessing import Pool
pool = Pool(cores)
result = pool.map(func, input)
pool.close()
return result
if __name__ == "__main__": if __name__ == "__main__":
import doctest import doctest