Prev: encodings.idna.ToASCII( unicodeStr ) != unicodeStr.encode( 'idna')
Next: Instance method decorator garbage collection problem
From: Mag Gam on 23 Jun 2010 06:24 I am looking for a simple multi threaded example. Lets say I have to ssh to 20 servers and I would like to that in parallel. Can someone please provide a an example for that? thanks
From: Stefan Behnel on 23 Jun 2010 06:58 Mag Gam, 23.06.2010 12:24: > I am looking for a simple multi threaded example. > > Lets say I have to ssh to 20 servers and I would like to that in > parallel. Can someone please provide a an example for that? Sounds like you want to run background processes, not threads. Take a look at the subprocess module. Stefan
From: Sandy on 24 Jun 2010 04:23
On Jun 23, 11:58 am, Stefan Behnel <stefan...(a)behnel.de> wrote: > Mag Gam, 23.06.2010 12:24: > > > I am looking for a simple multi threaded example. > > > Lets say I have to ssh to 20 servers and I would like to that in > > parallel. Can someone please provide a an example for that? > > Sounds like you want to run background processes, not threads. Take a look > at the subprocess module. > > Stefan I use ssh which in turn uses paramiko import os import ssh for i in xrange(len(tasks)): pid = os.fork() if pid == 0: # if child process s = ssh.Connection(host = server, log = False) s.execute(cmd) s.close() os._exit(0) time.sleep(1) os.waitpid(pid, 0) - dksr |