added worker
This commit is contained in:
parent
42cbfeb787
commit
d9844fff17
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user