スレッドと SSH を使用して、正確な瞬間にそれぞれ複数のリモート ジョブを起動する必要があります。だから私は書く:
def dojob(hostname):
command = "echo Done"
p = Popen(['ssh','%s@%s' % (user, hostname), command], stdout=PIPE, shell=False)
output = p.communicate()[0].strip()
print output
[...]
fire_starter = [Timer(t, dojob, [y]) for t,y in zip(instant, hosts)]
for e in fire_starter:
e.start()
コードは機能しますが、OS がゾンビでいっぱいになります。正直なところ、私は、communication() メソッドが子プロセスを処理し、その終了を待っていると信じていました。どこが間違っていますか?