I want to call a function, that starts a subprocess, like that:
processrrd = Popen(args1, stdout=PIPE, stderr=PIPE, env={'LANG':'de_DE@euro','TZ':'Europe/Berlin'})
outputrrd = processrrd.communicate()
(output, error) = outputrrd
Now I want to use multiprocessing.pool in order to paralize the worker.
The problem is that the variable outputrrd ist overwritten by the last Popen.
So, is it possible to create a specific variable (processrrd), like name1_processrrd?
Regards.
Stefan
UDPATE:
tried this one, but the output of the processes are the same….:
processrrd = []
processrrd.append((hostgroup+'_processrrd'))
print processrrd
for name in processrrd:
print name
name = Popen(args1, stdout=PIPE, stderr=PIPE, env={'LANG':'de_DE@euro','TZ':'Europe/Berlin'})
outputrrd = name.communicate()
(output, error) = outputrrd
Without even considering whether
multiprocessinggives you any better approaches (I’m guessing it does, but don’t know it very well at all), you’d be better off storing each handle in some sort of data structure, such as adictor alist, e.g.,