How to schedule system calls with Python
jlconlin at gmail.com
Fri Oct 16 06:43:47 CEST 2009
On Oct 15, 6:47 pm, Ishwor Gurung <ishwor.gur... at gmail.com> wrote:
> > 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.
> > How can I use Python to schedule these commands?
> If I were as lucky as you, I would have used multiprocessing module
> (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).
> Ishwor Gurung
Again another great suggestion. I was not aware of the
multiprocessing module, and I'm not (yet) sure if I understand why I
should use instead of multithreading as explained by a previous post.
More information about the Python-list