A question about subprocess
ldo at geek-central.gen.new_zealand
Thu Oct 4 09:58:51 CEST 2007
In message <1191429980.784610.39020 at 22g2000hsm.googlegroups.com>, JD wrote:
> I want send my jobs over a whole bunch of machines (using ssh). The
> jobs will need to be run in the following pattern:
> (Machine A) (Machine B) (Machine C)
> Job A1 Job B1 Job C1
> Job A2 Job B2 etc
> Job A3 etc
> Jobs runing on machine A, B, C should be in parallel, however, for
> each machine, jobs should run one after another.
> How can I do it with the subprocess?
You could do it with SSH. A command like
ssh machine_a run_job_a1.py
will not terminate until the execution of run_job_a1.py on the remote
machine has terminated. So you end up with a lot of "proxy" subprocesses,
if you like, on the master machine, each one waiting for a remote process
on some master machine to terminate. As the controlling process notices the
termination of each proxy process, it looks to see which slave machine that
maps to, and sends another command to start the next job on that machine.
More information about the Python-list