How to schedule system calls with Python
Ishwor Gurung
ishwor.gurung at gmail.com
Thu Oct 15 20:47:00 EDT 2009
Jeremy,
Hi
> I need to write a Python script that will call some command line
> programs (using os.system). I will have many such calls, but I want
> to control when the calls are made. I won't know in advance how long
> each program will run and I don't want to have 10 programs running
> when I only have one or two processors. I want to run one at a time
> (or two if I have two processors), wait until it's finished, and then
> call the next one.
Right.
> How can I use Python to schedule these commands?
If I were as lucky as you, I would have used multiprocessing module[1]
(my platform does not have sem_open() syscall). Others suggestions are
as good as it can be but yeah you could get a lot of work done using
multiprocessing module(all the relevant bits are explained in the
module doc).
[1] http://docs.python.org/library/multiprocessing.html
--
Regards,
Ishwor Gurung
More information about the Python-list
mailing list