Let child process to run while parent is out (multiprocessing)
gokoproject at gmail.com
Thu Jul 19 22:34:31 CEST 2012
build_id = create_build_id(...)
Suppose build_stuff compiles a C program. It could take days to finish, and
notify users their builds are ready. I was thinking about using
mutliprocessing to handle the build_stuff.
So here is a sample:
import multiprocessing as mp
print 'I am building HUGE things'
build_p = mp.Process(name='build process', target=build)
if __name__ == '__main__':
v = main()
Here is output:
yeukhon at fermat:~$ python c2.py
done [now hangs for 10 seconds]
I build things
When I looked at `ps -elf|grep python`, I can see two processes running,
and one of the python c2.py process is `wait`. But this is not ideal,
especially this is a web app. I can't implement any advanced queue / event
system right now (I use Pylon, I believe I have gevent installed). But just
with multiprocessing, is it possible to send the id first, while running
child in the backgroud?
Right now it hangs there as long as the child process is alive. Any
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list